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

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

private NestedTransactionScope8 ( ) : void
Результат void
        public void NestedTransactionScope8()
        {
            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(TransactionScopeOption.Suppress))
                {
                    /* Not transactional, so this WONT get committed */
                    irm2.Value = 20;
                    scope2.Complete();
                }
                irm2.Check(0, 0, 0, 0, "irm2");
                Assert.Equal(20, irm2.Value);
                Assert.Equal(TransactionStatus.Active, Transaction.Current.TransactionInformation.Status);

                scope.Complete();
            }

            Assert.Null(Transaction.Current);
            Assert.Equal(irm.Value, 2);
            irm.Check(1, 1, 0, 0, "irm");
        }