public async Task InterestCompoundCalculatorUnitTest_BiggerThanInitialValueAsync() { var initialValue = 100; var months = 5; var compoundCalculatorService = new CompoundCalculatorService(interestRateServiceMock.Object); var result = await compoundCalculatorService.CalculateCompoundInterestAsync(initialValue, months); Assert.True(result > initialValue); }
public async Task InterestCompoundCalculateIntegrationTest_IncorrectURLAsync() { var initialValue = 100; var months = 5; var configurationMock = new Mock<IConfiguration>(); configurationMock.SetupGet(c => c["InterestRateHost"]).Returns("/taxaDeJuros"); var interestRateService = new InterestRateService(httpClientFactory, configurationMock.Object); var compoundCalculatorService = new CompoundCalculatorService(interestRateService); await Assert.ThrowsAsync<HttpRequestException>(async () => await compoundCalculatorService.CalculateCompoundInterestAsync(initialValue, months)); }
public async Task InterestCompoundCalculateIntegrationTest_CorrectURLAsync() { var initialValue = 100; var months = 5; var configurationMock = new Mock<IConfiguration>(); configurationMock.SetupGet(c => c["InterestRateHost"]).Returns("/taxaJuros"); var interestRateService = new InterestRateService(httpClientFactory, configurationMock.Object); var compoundCalculatorService = new CompoundCalculatorService(interestRateService); var compoundCalculateValue = await compoundCalculatorService.CalculateCompoundInterestAsync(initialValue, months); Assert.True(compoundCalculateValue > initialValue); }
public async Task InterestCompoundCalculatorUnitTest_ArgumentValidationAsync(decimal initialValue, int months) { var compoundCalculatorService = new CompoundCalculatorService(interestRateServiceMock.Object); await Assert.ThrowsAsync <ArgumentOutOfRangeException>(async() => await compoundCalculatorService.CalculateCompoundInterestAsync(initialValue, months)); }