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

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

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

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

            AutoResetEvent pspeCompleted = new AutoResetEvent(false);
            NonMSDTCPromoterEnlistment pspe = null;

            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    TransactionStatus txStatus = Transaction.Current.TransactionInformation.Status;
                    Assert.Equal(TransactionStatus.Active, txStatus);

                    Guid distId = Transaction.Current.TransactionInformation.DistributedIdentifier;
                    Assert.Equal(Guid.Empty, distId);

                    pspe = (NonMSDTCPromoterEnlistment)CreatePSPEEnlistment(NonMsdtcPromoterTests.PromoterType1,
                        NonMsdtcPromoterTests.PromotedToken1,
                        pspeCompleted,
                        /*nonMSDTC = */ true,
                        /*tx = */ null,
                        /*spcResponse=*/ TransactionStatus.Committed,
                        /*expectRejection=*/ false
                        );

                    txStatus = Transaction.Current.TransactionInformation.Status;
                    Assert.Equal(TransactionStatus.Active, txStatus);

                    distId = Transaction.Current.TransactionInformation.DistributedIdentifier;
                    Assert.Equal(Guid.Empty, distId);

                    Promote(testCaseDescription, NonMsdtcPromoterTests.PromotedToken1);

                    txStatus = Transaction.Current.TransactionInformation.Status;
                    Assert.Equal(TransactionStatus.Active, txStatus);

                    distId = Transaction.Current.TransactionInformation.DistributedIdentifier;
                    Assert.NotEqual(distId, Guid.Empty);
                    ts.Complete();
                }

                TestPassed();
            }
            catch (Exception ex)
            {
                Assert.Null(ex);
            }
        }
NonMsdtcPromoterTests