public void TestTransactionPositive() { var obj = new SomeObj(); obj.IntProp = 20; using (var context = obj.ForgivableScope()) { context.Target.IntProp = 50; context.Complete(); } Assert.AreEqual(50, obj.IntProp); }
public void TestTransactionNegative() { var obj = new SomeObj(); obj.IntProp = 20; try { using (var context = obj.ForgivableScope()) { context.Target.IntProp = 50; throw new InternalTestFailureException(); context.Complete(); } } catch (InternalTestFailureException) { } Assert.AreEqual(20, obj.IntProp); }