public void TestDeveriaLancarExcecaoDeContaNaoEncontradaNoDeposito()
        {
            var transacaoRepositoryMock = new Mock <ITransacaoRepository>();
            var contaRepositoryMock     = new Mock <IContaCorrenteRepository>();

            contaRepositoryMock.Setup(x => x.FindByIdAsync(1)).Returns(Task.FromResult((IContaCorrente)null));

            var transacaoService = new TransacaoService(transacaoRepositoryMock.Object, contaRepositoryMock.Object);

            Assert.ThrowsAsync <ContaCorrenteNotFoundException>(async() => await transacaoService.DepositarAsync(1, 1));
        }
        public void TestDeveriaLancarExcecaoDeValorInvalidoNoDeposito(decimal valor)
        {
            IContaCorrente conta = new ContaCorrente(1, 0);

            var transacaoRepositoryMock = new Mock <ITransacaoRepository>();
            var contaRepositoryMock     = new Mock <IContaCorrenteRepository>();

            contaRepositoryMock.Setup(x => x.FindByIdAsync(1)).Returns(Task.FromResult(conta));

            var transacaoService = new TransacaoService(transacaoRepositoryMock.Object, contaRepositoryMock.Object);

            Assert.ThrowsAsync <ValorDeCreditoInvalidoException>(async() => await transacaoService.DepositarAsync(1, valor));
        }
        public async Task TestDeveriaDepositarCorretamenteAsync(decimal saldoInicial, decimal valorDeposito, decimal saldoPosDeposito, decimal valorTarifa, decimal saldoPosTarifa)
        {
            IContaCorrente conta = new ContaCorrente(1, saldoInicial);

            var transacaoRepositoryMock = new Mock <ITransacaoRepository>();
            var contaRepositoryMock     = new Mock <IContaCorrenteRepository>();

            contaRepositoryMock.Setup(x => x.FindByIdAsync(1)).Returns(Task.FromResult(conta));

            var transacaoService = new TransacaoService(transacaoRepositoryMock.Object, contaRepositoryMock.Object);

            var transacao = await transacaoService.DepositarAsync(1, valorDeposito);

            Assert.Equal(saldoInicial, transacao.SaldoAnterior);
            Assert.Equal(valorDeposito, transacao.Valor);
            Assert.Equal(saldoPosDeposito, transacao.SaldoFinal);
            Assert.Equal(saldoPosDeposito, transacao.Tarifa.SaldoAnterior);
            Assert.Equal(valorTarifa, transacao.Tarifa.Valor);
            Assert.Equal(saldoPosTarifa, transacao.Tarifa.SaldoFinal);
            Assert.Equal(saldoPosTarifa, transacao.Conta.Saldo);
        }