コード例 #1
0
ファイル: MySqlTests.cs プロジェクト: barsae/DataFace
        public void MySql_CommitTransaction_HasSideEffect()
        {
            IDatabaseConnection connection = GetConnection();
            InitializeDatabase(connection);

            var repo = new MySqlIntegrationRepository(GetConnection());
            using (var transaction = repo.WithTransaction()) {
                repo.SprocWithSideEffect();
                transaction.Commit();
            }

            Assert.AreEqual(1, repo.GetCountOfSideEffects());
        }
コード例 #2
0
        public void MySql_RollbackTransaction_DoesntHaveSideEffect()
        {
            IDatabaseConnection connection = GetConnection();

            InitializeDatabase(connection);

            var repo = new MySqlIntegrationRepository(GetConnection());

            using (var transaction = repo.WithTransaction()) {
                repo.SprocWithSideEffect();
                transaction.Rollback();
            }

            Assert.AreEqual(0, repo.GetCountOfSideEffects());
        }
コード例 #3
0
        public void MySql_CommitTransaction_HasSideEffect()
        {
            IDatabaseConnection connection = GetConnection();

            InitializeDatabase(connection);

            var repo = new MySqlIntegrationRepository(GetConnection());

            using (var transaction = repo.WithTransaction()) {
                repo.SprocWithSideEffect();
                transaction.Commit();
            }

            Assert.AreEqual(1, repo.GetCountOfSideEffects());
        }
コード例 #4
0
ファイル: MySqlTests.cs プロジェクト: barsae/DataFace
        public void MySql_RollbackTransaction_DoesntHaveSideEffect()
        {
            IDatabaseConnection connection = GetConnection();
            InitializeDatabase(connection);

            var repo = new MySqlIntegrationRepository(GetConnection());
            using (var transaction = repo.WithTransaction()) {
                repo.SprocWithSideEffect();
                transaction.Rollback();
            }

            Assert.AreEqual(0, repo.GetCountOfSideEffects());
        }