Esempio n. 1
0
        public virtual void EnlistTransaction()
        {
            HsqlConnection testSubject = new HsqlConnection();

            using (TransactionScope transactionScope = new TransactionScope(TransactionScopeOption.Required))
            {
                testSubject.Open();
                testSubject.EnlistTransaction(Transaction.Current);

                try
                {
                    testSubject.BeginTransaction();

                    Assert.Fail("The test subject allowed a local transaction to be started "
                                + "explicitly while participating in a system transaction");
                }
                catch (Exception)
                {
                }

                transactionScope.Complete();

                try
                {
                    testSubject.BeginTransaction();

                    Assert.Fail("The test subject allowed a local transaction to be started "
                                + "explicitly while participating in a system transaction");
                }
                catch (Exception)
                {
                }
            }

            using (HsqlTransaction transaction = testSubject.BeginTransaction())
            {
                transaction.Commit();
            }
        }