System.Transactions.Tests.NonMsdtcPromoterTests.TestCase_PromoterTypeMSDTC C# (CSharp) Метод

TestCase_PromoterTypeMSDTC() публичный статический Метод

public static TestCase_PromoterTypeMSDTC ( ) : void
Результат void
        public static void TestCase_PromoterTypeMSDTC()
        {
            string testCaseDescription = "TestCase_PromoterTypeMSDTC";

            Trace("**** " + testCaseDescription + " ****");

            AutoResetEvent volCompleted = new AutoResetEvent(false);
            MyEnlistment vol = null;

            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    Assert.Equal(Guid.Empty, TxPromoterType(Transaction.Current));

                    vol = CreateVolatileEnlistment(volCompleted);

                    // Force MSDTC promotion.
                    TransactionInterop.GetDtcTransaction(Transaction.Current);

                    // TransactionInterop.PromoterTypeDtc
                    Assert.Equal(PromoterTypeDtc, TxPromoterType(Transaction.Current));

                    ts.Complete();
                }
            }
            catch (Exception ex)
            {
                Trace(string.Format("Caught unexpected exception {0}:{1}", ex.GetType().ToString(), ex.ToString()));
                return;
            }

            Assert.True(volCompleted.WaitOne(TimeSpan.FromSeconds(5)));

            Assert.True(vol.CommittedOutcome);

            TestPassed();
        }
NonMsdtcPromoterTests