System.Transactions.Tests.TransactionScopeTest.NestedTransactionScope5 C# (CSharp) Метод

NestedTransactionScope5() приватный Метод

private NestedTransactionScope5 ( ) : void
Результат void
        public void NestedTransactionScope5()
        {
            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();
                }

                Assert.Equal(TransactionStatus.Active, Transaction.Current.TransactionInformation.Status);
                /* Not completing outer scope
                scope.Complete (); */
            }

            Assert.Null(Transaction.Current);

            Assert.Equal(irm.Value, 1);
            Assert.Equal(irm2.Value, 10);
            irm.Check(0, 0, 1, 0, "irm");
            irm2.Check(0, 0, 1, 0, "irm2");
        }