예제 #1
0
        public void Creditar(CreditoCommand creditoCommand)
        {
            var conta = _contaRepositorio.ObterPorId(creditoCommand.ContaId);

            conta.Creditar(creditoCommand.Valor);
            _contaRepositorio.Editar(conta);
        }
예제 #2
0
        public IActionResult Creditar(CreditoViewModel model)
        {
            if (!ModelState.IsValid)
            {
                CarregarDropUsuario();
                return(View(model));
            }

            var creditoCommand = new CreditoCommand(model.ContaId, model.Valor);

            _movimentacaoAppServico.Creditar(creditoCommand);

            return(RedirectToAction(nameof(Index)));
        }
예제 #3
0
        public void Creditar_valor_em_conta()
        {
            var creditoCommand = new CreditoCommand(_contaId, _valor);

            var contaRepositorioMock = new Mock <IContaRepositorio>();

            contaRepositorioMock.Setup(c => c.ObterPorId(_contaId)).Returns(_contaFake);

            var contaServico = new MovimentacaoDominioServico(contaRepositorioMock.Object);

            contaServico.Creditar(creditoCommand);

            Assert.Equal(_saldoAntigo.Valor + _valor, _contaFake.Saldo.Valor);
        }
예제 #4
0
 public void Creditar(CreditoCommand creditoCommand)
 {
     _movimentacaoDominioServico.Creditar(creditoCommand);
     Save();
 }