I read the Book NHibernate in Action and there it is speaking about testing the persistence layer/data abstraction layer. You can test two ways. The mapping-test and the persistence logic-test. Accoring to the book testing the mapping means that entities are correctly loaded and saved.
But what's about update's and delete's?
By now I use Fluent NHibernate and this is also only testing for loading and saving.
How do I te开发者_如何转开发st a persistence layer correctly?
On past projects, I've written NUnit tests that exercised the update and delete NHibernate logic against a SQLite DB.
I'm not advocating this as the correct way to do things though. I'd be reasonably comfortable that if NHibernate is successfully performing saves and loads, it'll be able to update and delete.
A good guide to unit test patterns can be found here: http://www.codeproject.com/KB/architecture/autp5.aspx
精彩评论