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: