Пример #1
0
        public void does_not_commit_transaction_when_error_occured()
        {
            Assert.Throws <ArgumentException>(() => strategy.Execute(c => { throw new ArgumentException(); }));
            strategy.Dispose();

            transaction.DidNotReceive().Commit();
        }
        public void does_not_commit_transaction_on_error()
        {
            Assert.Throws <ArgumentException>(() => strategy.Execute(c => { throw new ArgumentException(); }));
            Assert.Throws <ArgumentException>(() => strategy.Execute <bool>(c => { throw new ArgumentException(); }));

            transaction.DidNotReceive().Commit();
        }
Пример #3
0
        public void CreateTransactionWithDefaultIsolationLevelAndRollback_CheckIfRollbacked_ExpectTrue()
        {
            _dbUtilsStub.CreateConnection(_connectionString).Returns(_connectionStub);
            _connectionStub.BeginTransaction(_defaultLevel).Returns(_transactionStub);

            using (var dbManager = CreateDbManager())
                dbManager.StartConnection();

            _transactionStub.Received().Rollback();
            _transactionStub.DidNotReceive().Commit();
        }