public void Setup() { _httpClient = new Mock <IHttpClientWrapper>(); _azureAdAuthService = new Mock <IAzureAdAuthenticationService>(); _apiClientConfiguration = new ForecastingApiClientConfiguration { ApiBaseUrl = "testUrl", ClientId = "clientId", ClientSecret = "secret", IdentifierUri = "test", Tenant = "tenant" }; _expectedAccountExpiringFunds = new ExpiringAccountFunds { AccountId = ExpectedAccountId, ProjectionGenerationDate = DateTime.Now, ExpiryAmounts = new List <ExpiringFunds> { new ExpiringFunds { PayrollDate = DateTime.Now.AddMonths(2), Amount = 200 } } }; _logger = new Mock <ILog>(); _service = new EmployerFinance.Services.DasForecastingService(_httpClient.Object, _azureAdAuthService.Object, _apiClientConfiguration, _logger.Object); _httpClient.Setup(c => c.Get <ExpiringAccountFunds>(It.IsAny <string>(), It.IsAny <string>())) .ReturnsAsync(_expectedAccountExpiringFunds); _azureAdAuthService.Setup(s => s.GetAuthenticationResult( _apiClientConfiguration.ClientId, _apiClientConfiguration.ClientSecret, _apiClientConfiguration.IdentifierUri, _apiClientConfiguration.Tenant)).ReturnsAsync(AccessToken); }
public void Setup() { _httpClient = new Mock <IHttpClientWrapper>(); _azureAdAuthService = new Mock <IAzureAdAuthenticationService>(); _apiClientConfiguration = new ForecastingApiClientConfiguration { ApiBaseUrl = "testUrl", ClientId = "clientId", ClientSecret = "secret", IdentifierUri = "test", Tenant = "tenant" }; _expectedProjectedCalculations = new ProjectedCalculation { AccountId = ExpectedAccountId, ProjectionGenerationDate = DateTime.Now, FundsIn = ExpectedFundsIn, FundsOut = ExpectedFundsOut, NumberOfMonths = 12 }; _logger = new Mock <ILog>(); _service = new EmployerFinance.Services.DasForecastingService(_httpClient.Object, _azureAdAuthService.Object, _apiClientConfiguration, _logger.Object); _httpClient.Setup(c => c.Get <ProjectedCalculation>(It.IsAny <string>(), It.IsAny <string>())) .ReturnsAsync(_expectedProjectedCalculations); _azureAdAuthService.Setup(s => s.GetAuthenticationResult( _apiClientConfiguration.ClientId, _apiClientConfiguration.ClientSecret, _apiClientConfiguration.IdentifierUri, _apiClientConfiguration.Tenant)).ReturnsAsync(AccessToken); }