public void NestedTransactionScope3()
{
IntResourceManager irm = new IntResourceManager(1);
IntResourceManager irm2 = new IntResourceManager(10);
Assert.Null(Transaction.Current);
using (TransactionScope scope = new TransactionScope())
{
irm.Value = 2;
using (TransactionScope scope2 = new TransactionScope())
{
irm2.Value = 20;
scope2.Complete();
}
scope.Complete();
}
Assert.Null(Transaction.Current);
/* Both got committed */
Assert.Equal(irm.Value, 2);
Assert.Equal(irm2.Value, 20);
irm.Check(1, 1, 0, 0, "irm");
irm2.Check(1, 1, 0, 0, "irm2");
}