Rollback db unit test

I couldn’t make Roy’s XtUnit working in my test cases. Tried to switch to MbUnit, but Resharper 4 still doesn’t support it yet. Later, I found there are some posts (here, and here) pointing out the very easy solution for this: System.Transactions.TransactionScope.

I then adopt this trick, created my own DBTestFixtureInTheRollBackTransactionclass.

It works, and like the author said, embarrassingly simple!

Advertisements