Ejemplo n.º 1
0
        public void ShouldNotCloseClosedConnectionDuringCleanUp()
        {
            _connectionMock.Setup(x => x.State).Returns(ConnectionState.Closed);
            var connectionHandler = new ConnectionHandler().GetHandler(_dbCommandMock.Object, _transactionWrapperMock.Object);

            connectionHandler.RollbackTransactionAndCloseConnection();

            _connectionMock.Verify(x => x.Close(), Times.Never());
        }
Ejemplo n.º 2
0
        public void ShouldNotRollbackTransactionWhenNoTransactionIsInProgress()
        {
            _transactionWrapperMock.Setup(x => x.TransactionInProgress).Returns(false);
            var connectionHandler = new ConnectionHandler().GetHandler(_dbCommandMock.Object, _transactionWrapperMock.Object);

            connectionHandler.RollbackTransactionAndCloseConnection();

            _transactionWrapperMock.Verify(x => x.Rollback(), Times.Never());
        }