public void UseTransactionScopeTest()
 {
     AdoWith.TransactionScope(TransactionScopeOption.Required,
                              System.Transactions.IsolationLevel.ReadCommitted,
                              SetParameterValuesGeneric,
                              MethodInTransaction);
 }
Exemple #2
0
        // [ThreadedRepeat(3)]
        public void MultipleActionsForTesting2()
        {
            var originalCount = TotalCount();

            AdoWith.ForTesting(AdoTool.AdoIsolationLevel,
                               DeleteActionTest,
                               InsertActionTest,
                               DeleteActionTest,
                               InsertActionTest,
                               DeleteActionTest);

            Assert.AreEqual(originalCount, TotalCount());
        }
Exemple #3
0
        public void NotCommittedAction()
        {
            var originalCount = TotalCount();

            // Run Test
            AdoWith.ForTesting(InsertActionTest);

            // use Extension Method
            Action insertAction = InsertActionTest;

            insertAction.ForTesting();

            Assert.AreEqual(originalCount, TotalCount());
        }
Exemple #4
0
        public void NotCommitted()
        {
            var originalCount = TotalCount();

            AdoWith.ForTesting(() => {
                AdoRepository.ExecuteNonQuery(SQL_REGION_INSERT);
                AdoRepository.ExecuteNonQuery(SQL_REGION_INSERT2);
                var insertedCount = TotalCount();

                Assert.AreEqual(originalCount + 2, insertedCount);
            });

            var rollbackCount = TotalCount();

            Assert.AreEqual(originalCount, rollbackCount);
        }
 public void TransactionScope_ShouldNotPromoteToDTC3()
 {
     TestTool.RunTasks(10,
                       () => AdoWith.TransactionScope(TransactionScopeOption.Required,
                                                      System.Transactions.IsolationLevel.ReadCommitted,
                                                      delegate { var count = TotalCount(); },
                                                      delegate {
         NorthwindAdoRepository.ExecuteNonQueryBySqlString(SQL_REGION_INSERT);
         NorthwindAdoRepository.ExecuteNonQueryBySqlString(SQL_REGION_INSERT2);
         NorthwindAdoRepository.ExecuteNonQueryBySqlString(SQL_REGION_DELETE);
     },
                                                      delegate {
         var ds =
             NorthwindAdoRepository.ExecuteDataSetBySqlString(
                 SQL_REGION_SELECT, 1, 10);
     },
                                                      delegate {
         var dt =
             NorthwindAdoRepository.ExecuteDataTableBySqlString(
                 SQL_REGION_SELECT, 1, 10);
     }
                                                      ));
 }