public IActionResult PostCalculaJurosViewModel(CalculaJurosViewModel calculaJurosViemModel) { if (!ModelState.IsValid) { return(Response(calculaJurosViemModel)); } try { var retorno = _calculoJurosService.Calcular(calculaJurosViemModel); return(Response(retorno.ToString("N2"))); } catch (BusinessException ex) { return(new ObjectResult($"Erro ao calcular juros: {ex.Message}")); } }
public ActionResult <decimal> CalcularJuros(decimal valorInicial, int tempo) { double taxa = _taxaJurosService.GetTaxaJuros().Result; return(Ok(_calculoJurosService.Calcular(valorInicial, taxa, tempo))); }
public void TesteCalculoJuros() { decimal juros = _calculoJurosService.Calcular(100.00m, 0.01, 5); Assert.AreEqual(105.10m, juros, "Juros"); }