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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s