示例#1
0
        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}"));
            }
        }
示例#2
0
        public ActionResult <decimal> CalcularJuros(decimal valorInicial, int tempo)
        {
            double taxa = _taxaJurosService.GetTaxaJuros().Result;

            return(Ok(_calculoJurosService.Calcular(valorInicial, taxa, tempo)));
        }
示例#3
0
        public void TesteCalculoJuros()
        {
            decimal juros = _calculoJurosService.Calcular(100.00m, 0.01, 5);

            Assert.AreEqual(105.10m, juros, "Juros");
        }