public void Creditar(CreditoCommand creditoCommand) { var conta = _contaRepositorio.ObterPorId(creditoCommand.ContaId); conta.Creditar(creditoCommand.Valor); _contaRepositorio.Editar(conta); }
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))); }
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); }
public void Creditar(CreditoCommand creditoCommand) { _movimentacaoDominioServico.Creditar(creditoCommand); Save(); }