public void AoCancelarUmaTransacaoAConexaoDeveEstarFechada() { var mockConexao = CriarMockDaConexao(); var transacao = new Transacao(mockConexao.Object); transacao.IniciarTransacao(); transacao.CancelarTransacao(); mockConexao.Verify(c => c.Close()); }
public void SeExcluirObjetoTransacaoComUmaTransacaoEmAndamentoAMesmaDeveSerCancelada() { var mockTransacao = CriarMockDaTransacao(); var mockConexao = CriarMockDaConexao(mockTransacao); using (var transacao = new Transacao(mockConexao.Object)) { transacao.IniciarTransacao(); } mockTransacao.Verify(t => t.Rollback()); mockTransacao.Verify(t => t.Dispose()); }
public void AoCancelarUmaTransacaoATransacaoDeveSerLimpa() { var mockTransacao = CriarMockDaTransacao(); var mockConexao = CriarMockDaConexao(mockTransacao); var transacao = new Transacao(mockConexao.Object); transacao.IniciarTransacao(); transacao.CancelarTransacao(); transacao.TransacaoAtual .Should().BeNull(); transacao.EmTransacao .Should().BeFalse(); mockTransacao.Verify(t => t.Dispose()); }