System.Transactions.Tests.TransactionScopeTest.ExplicitTransaction6d C# (CSharp) 메소드

ExplicitTransaction6d() 개인적인 메소드

private ExplicitTransaction6d ( ) : void
리턴 void
        public void ExplicitTransaction6d()
        {
            CommittableTransaction ct = new CommittableTransaction();

            IntResourceManager irm = new IntResourceManager(1);

            Transaction.Current = ct;
            try
            {
                TransactionScope scope1 = new TransactionScope();
                /* Enlist */
                irm.Value = 2;

                TransactionScope scope2 = new TransactionScope(TransactionScopeOption.RequiresNew);
                Assert.Throws<InvalidOperationException>(() => scope1.Dispose());
                scope2.Dispose();
            }
            finally
            {
                Transaction.Current = null;
            }
        }