For many reasons, I have written a tool to generate Data Access Layer classes, in addition to other basic plumbing for applications. My tool also generates Unit Test classes to validate the properties, methods, and constructors.
Of course one of the most important sets of method types I need to validate are the ones that actually persist record creations, updates, and deletes to the back end data store (MS SQL Server 2005).
I had hoped to be able to create an instance of a System.Transactions.TransactionScope object in my "MyClassInitialize" method with the <ClassInitialize()> attribute. I get no errors instantiating it, but I get errors of the following type when my test run completes:
Class Cleanup method ContactTest.MyClassCleanup failed.
Error Message: System.InvalidOperationException: A TransactionScope must be disposed on the same thread that it was created.. Stack Trace: ...
I want to be able to do all my database changes in a sandbox and feel certain that I won't goof anything up.
I looked through this forum, but didn't see a post specifically about this type of issue and its resolution.
Visual Studio Team System34