Search The Blog
My Books

New:

My Songs

 

The Art of Unit Testing

Buy PDF or Print book at Manning

Buy on Amazon

Latest Posts
from 5whys.com
Twitter: @RoyOsherove
About this site

TDD in .NET Online Course

TDD and BDD in Ruby Online Course

 

Subscribe!

This site aims to connect all the dots of my online activities - from tools, books blogs and twitter accounts, to upcoming conferences, engagements and user group talks.

« Which Specification Style Framework in .NET are you using? | Main | Poll> Which IoC frameworks Are you actively using in your current .NET projects? »
Friday
Mar292013

Using System.Transactions.TransactionScope to Rollback Database changes under an integration test

It has been several years since I came up with the idea of database rolled back tests based on com+ transactions, which later became ServicedComponent tests, which later became TransactionScope aided tests.

At some point, a DataRollback attribute was added to NUnIt, but them removed for some reason, that used this idea. I know it exists in MbUnit…. ANYWAY.

I never blogged about the TransactionScope solution in this blog,

so here is a very simple way to rollback database  changes that your code under test performs under an integration test, so that the DB is not dirtied up for the next test Just use System.Transactions.TransactionScope class:

 

PrintView Printer Friendly Version

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>
Web Analytics