public void CalcularJurosUmPorcento_100000_100(decimal valorInicial, int meses)
        {
            var calculaJurosService = new CalculaJurosService();
            var result = calculaJurosService.CalcularUmPorcentoMeses(new Valores()
            {
                ValorInicial = valorInicial, Meses = meses
            });

            Assert.Equal(270481.38M, result.Resultado);
        }
Example #2
0
        public void Tempo_Menor_Que_Zero()
        {
            var httpClientFactoryMock = Substitute.For <IHttpClientFactory>();

            var calculaJurosService = new CalculaJurosService(httpClientFactoryMock);

            var valorInicial = 100.00m;
            var tempo        = -5;

            Assert.ThrowsAsync <Exception>(() => calculaJurosService.CalculaJurosAsync(valorInicial, tempo));
        }
Example #3
0
        public void CalculaJuros_Retorna_Decimal()
        {
            var httpClientFactoryMock = Substitute.For <IHttpClientFactory>();

            var calculaJurosService = new CalculaJurosService(httpClientFactoryMock);

            var valorInicial = 100.00m;
            var tempo        = 5;

            Assert.IsType <Task <decimal> >(calculaJurosService.CalculaJurosAsync(valorInicial, tempo));
        }
Example #4
0
        public async Task Result_Should_Be_GreaterThan()
        {
            //Arrange
            var valorInicial = 200m;
            var meses        = 7;
            var service      = new CalculaJurosService(_httpClient, _settings);

            //Act
            var valorFinal = await service.CalcularJuros(valorInicial, meses);

            //Assert
            Assert.IsTrue(valorFinal > 0);
        }
        public async Task TestCalculaJuros()
        {
            decimal decValorInicial = 100m;
            int     intMeses        = 5;
            decimal decToCompare    = 105.10m;

            CalculaJurosService objCalculaJurosService = new CalculaJurosService(objClient, objConfig);
            decimal             decResultado           = await objCalculaJurosService.CalcularJuros(new CalculaJuros()
            {
                ValorEntrada = decValorInicial, Meses = intMeses
            });

            Assert.AreEqual(decToCompare, decResultado);
        }
Example #6
0
        public async Task Result_Should_Be_Zero()
        {
            //Arrange
            var valorInicial = 0m;
            var meses        = 5;
            var esperado     = 0;
            var service      = new CalculaJurosService(_httpClient, _settings);

            //Act
            var valorFinal = await service.CalcularJuros(valorInicial, meses);

            //Assert
            Assert.AreEqual(esperado, valorFinal);
        }
Example #7
0
        public async void DeveCalcularJurosCompostosCorretamente(
            decimal taxaJuros,
            decimal valorInicial,
            int meses,
            decimal jurosEsperado
            )
        {
            var taxaJurosApiService = A.Fake <ITaxaJurosApiService>();

            A.CallTo(() => taxaJurosApiService.ObterTaxaJuros(A <CancellationToken> .Ignored))
            .Returns(taxaJuros);

            var service = new CalculaJurosService(taxaJurosApiService);

            var jurosComposto = await service.CalcularJurosComposto(valorInicial, meses, default(CancellationToken));

            Assert.Equal(jurosEsperado, jurosComposto);
        }
Example #8
0
 public CalculaJurosServiceUnitTest()
 {
     _service = new CalculaJurosService();
 }
 public CalculaJurosController()
 {
     _calc = new CalculaJurosService();
 }
Example #10
0
 public CalcularJurosServiceTests()
 {
     _taxaJurosService.Setup(x => x.ObterAsync()).Returns(Task.FromResult(0.01m));
     _calculaJurosService = new CalculaJurosService(_taxaJurosService.Object);
 }
Example #11
0
 public TesteController()
 {
     _jurosService = new CalculaJurosService();
 }
Example #12
0
 public CalculaJurosTests()
 {
     _taxaJurosServiceMock = new Mock <ITaxaJurosService>();
     _service = new CalculaJurosService(_taxaJurosServiceMock.Object);
 }
 public CalculaJurosServiceUnitTest()
 {
     _mockTaxaJurosService = new Mock <ITaxaJurosService>();
     _service = new CalculaJurosService(_mockTaxaJurosService.Object);
 }