In test cases I change some rows, add and remove. how to restore it. I try use this way: using PostSharp -AOP framework + TransactionScope objects. on OnEntry in testcase method I create transaction on OnExit from testcase method I remove it:
[Serializable]
class DoNotMakeChangesInBase : OnMethodBoundaryAspect {
public override void OnEntry(MethodExecutionEventArgs context) {
context.MethodExecutionTag = new TransactionScope();
}
public override void OnExit(MethodExecutionEventArgs context) {
using (context.MethodExecutionTag as IDisposable) ;
}
}
///using this as:
[DoNotMakeChangesInBase ]
[Test]
public void MyTestCase(){....}