[Edit (Haren): Duplicate]
I'm looking for a way to automatically wrap my NUnit integration tests in a DB transaction, so that changes made by the test are automatically rolled back when the test ends. Ideally, I would decorate certain test methods with a custom attribute that would cause NUnit to create a transaction when the test starts and roll it back when the test ends... I can write the attribute, but I don't know where to add a check for it.
The test DB is 3GB in size, so restoring it at the start of each test isn't an option. I know I can manually create a transaction in the body of each test, but I'm looking for something more elegant.
Perhaps there's an IL-rewriting tool (an AOP framework, maybe) that can do this for me? Anyone have any suggestions?