Esempio n. 1
0
        public void Deve_Calcular_Juros()
        {
            //arange
            var valorInicial = 100d;
            var meses        = 5;

            //act
            var juros = _jurosService.CalcularJuros(valorInicial, meses);

            var expect = 105.10m;

            //assert
            juros.Should().Equals(expect);
        }
        public async Task <IActionResult> Index(JurosViewModel jurosViewModel)
        {
            var resposta = await _jurosService.CalcularJuros(jurosViewModel);

            if (ResponsePossuiErros(resposta))
            {
                return(View("Index", new JurosViewModel()));
            }

            return(View("Index", resposta.Data));
        }
        public async Task <ActionResult <JurosViewModel> > CalcularJuros(JurosViewModel fornecedorViewModel)
        {
            fornecedorViewModel = _mapper.Map <JurosViewModel>(await _jurosService.CalcularJuros(_mapper.Map <Juros>(fornecedorViewModel)));

            if (!OperacaoValida())
            {
                return(CustomResponse(fornecedorViewModel));
            }

            return(CustomResponse(fornecedorViewModel));
        }
Esempio n. 4
0
        public IActionResult CalcularJuros(double valorInicial, int meses)
        {
            ResponseModel model = _JurosService.CalcularJuros(valorInicial, meses);

            try
            {
                return(Ok(model));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
Esempio n. 5
0
 public ActionResult CalcularJuros(double valorInicial, int meses)
 {
     return(Ok(jurosService.CalcularJuros(valorInicial, meses)));
 }
 public IActionResult CalcularJuros([FromQuery(Name = "valor_inicial")] double valorInicial, [FromQuery(Name = "meses")] int meses)
 {
     return(Ok(_jurosService.CalcularJuros(valorInicial, meses)));
 }
Esempio n. 7
0
        public void CalcularJurosComposto()
        {
            decimal valorEsperado = 105.10m;

            Assert.Equal(jurosService.CalcularJuros(100, 5), valorEsperado);
        }