what test data approach/framework is recommended for .net unit testing

坚强是说给别人听的谎言 提交于 2019-12-12 04:34:45

问题


what test data approach/framework is recommended for .net unit testing? I'm in VS2010, C#, doing business logic layer testing.

By approaches I mean like: creating database snapshots, programmatically creating each time, etc etc. Like what approach to use to ensure at the start of each test the database is in a known state.


回答1:


Some would say that if you're using the database, then you're doing functional testing, not unit testing.




回答2:


This is not directly related to database testing. But in general when we need to setup test data we can use a library called NBuilder. It can create single instance of a calss as well as a list of instances. It uses a very fluent interface and is very easy to use. I had written a blog about the same.



来源:https://stackoverflow.com/questions/2936737/what-test-data-approach-framework-is-recommended-for-net-unit-testing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!