How do I test database-related code with NUnit?

后端 未结 5 1659
谎友^
谎友^ 2020-11-28 18:45

I want to write unit tests with NUnit that hit the database. I\'d like to have the database in a consistent state for each test. I thought transactions would allow me to \"u

5条回答
  •  悲&欢浪女
    2020-11-28 18:56

    For this sort of testing, I experimented with NDbUnit (working in concert with NUnit). If memory serves, it was a port of DbUnit from the Java platform. It had a lot of slick commands for just the sort of thing you're trying to do. The project appears to have moved here:

    http://code.google.com/p/ndbunit/

    (it used to be at http://ndbunit.org).

    The source appears to be available via this link: http://ndbunit.googlecode.com/svn/trunk/

提交回复
热议问题