I want to implement integration tests of my Entity Framework driven repositories. The problem is how to rollback database state after tests are done. At the moment I’m planning to start transaction at test SetUp and roll it back at test TearDown. Are there any other solutions excepting manual database clearing?
I want to implement integration tests of my Entity Framework driven repositories. The problem
Share
We do this in our integration tests while using MSTest. We use the
TransactionScopeand implement a test setup and teardown in a base class. This allows you to run all integration tests within a transaction. The base class looks much like this:Good luck.