public void InterestRateController_ShoulNotReturnEmptyOrNullValue() { InterestRateService interestRateService = new InterestRateService(); var result = interestRateService.GetInterestRate(); Assert.NotNull(result.ToString()); Assert.NotEmpty(result.ToString()); }
public void CalculateImpactOfBaseRateChange_WhenUserWithAgreementIsNotFound_ShoulThrowAnException() { this.SetupUserRepositoryGetToReturn(null); var service = new InterestRateService(this.uowMock.Object, this.baseRateServiceMock.Object); Assert.ThrowsAsync <EntityNotFoundException>( async() => await service.CalculateImpactOfBaseRateChange(It.IsAny <long>(), It.IsAny <long>(), It.IsAny <BaseRateCodeEnum>()) ); }
public InterestRateServiceTest() { _fixture = new Fixture(); _urlsConfig = _fixture.Create <UrlsConfig>(); _httpRequestService = new Mock <IHttpRequestService>(); _service = new InterestRateService( _httpRequestService.Object, _urlsConfig); }
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); }