System.Transactions.Tests.TransactionScopeTest.RMFail2 C# (CSharp) Method

RMFail2() private method

private RMFail2 ( ) : void
return void
        public void RMFail2()
        {
            IntResourceManager irm = new IntResourceManager(1);
            IntResourceManager irm2 = new IntResourceManager(10);
            IntResourceManager irm3 = new IntResourceManager(12);

            Assert.Null(Transaction.Current);
            TransactionAbortedException e = Assert.Throws<TransactionAbortedException>(() =>
            {
                using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(0, 0, 10)))
                {
                    irm.Value = 2;
                    irm2.Value = 20;
                    irm3.Value = 24;

                    /* irm2 wont call Prepared or ForceRollback in
                     * its Prepare (), so TransactionManager will timeout
                     * waiting for it
                     */
                    irm2.IgnorePrepare = true;
                    scope.Complete();
                }
            });

            Assert.NotNull(e.InnerException);
            Assert.IsType<TimeoutException>(e.InnerException);
            Assert.Null(Transaction.Current);
        }