开发者

How to test a persistence layer correctly?

开发者 https://www.devze.com 2022-12-15 15:34 出处:网络
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. Accori

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

0

精彩评论

暂无评论...
验证码 换一张
取 消