Example #1
0
        public void AoCancelarUmaTransacaoAConexaoDeveEstarFechada()
        {
            var mockConexao = CriarMockDaConexao();
            var transacao   = new TransacaoFake(mockConexao.Object);

            transacao.IniciarTransacao();
            transacao.CancelarTransacao();

            mockConexao.Verify(c => c.Close());
        }
Example #2
0
        public void SeExcluirObjetoTransacaoFakeComUmaTransacaoEmAndamentoAMesmaDeveSerCancelada()
        {
            var mockTransacao = CriarMockDaTransacao();
            var mockConexao   = CriarMockDaConexao(mockTransacao);

            using (var transacao = new TransacaoFake(mockConexao.Object))
            {
                transacao.IniciarTransacao();
            }

            mockTransacao.Verify(t => t.Rollback());
            mockTransacao.Verify(t => t.Dispose());
        }
Example #3
0
        public void AoCancelarUmaTransacaoATransacaoDeveSerLimpa()
        {
            var mockTransacao = CriarMockDaTransacao();
            var mockConexao   = CriarMockDaConexao(mockTransacao);
            var transacao     = new TransacaoFake(mockConexao.Object);

            transacao.IniciarTransacao();
            transacao.CancelarTransacao();
            transacao.TransacaoAtual
            .Should().BeNull();
            transacao.EmTransacao
            .Should().BeFalse();

            mockTransacao.Verify(t => t.Dispose());
        }