views:

60

answers:

1

Hi I'm testing some CRUD operations in Nhibernate.

I have 3 tests in this order - add update and delete.

When I test the update procedure I always get a fail as the object I just added is null. Do I need to close the session or do a flush before doing the update test. Or is there a better way for me to do this. Any help more than appreciated. Thanks

+2  A: 

You need to flush the session. That will make sure the item has been persisted into your database.

Also if you are using Fluent NH (which you might consider doing) you can get this out of the box - http://wiki.fluentnhibernate.org/Persistence_specification_testing (or better with less hassle).

Rashack
Super, thanks a lot!
Chin