public void Arrange() { _configuration = new HmrcConfiguration { BaseUrl = ExpectedBaseUrl, ClientId = ExpectedClientId, Scope = ExpectedScope, ClientSecret = ExpectedClientSecret }; _httpClientWrapper = new Mock <IHttpClientWrapper>(); _apprenticeshipLevyApiClient = new Mock <IApprenticeshipLevyApiClient>(); _apprenticeshipLevyApiClient.Setup(x => x.GetAllEmployers(It.IsAny <string>())).ReturnsAsync(new EmprefDiscovery { Emprefs = new List <string> { ExpectedEmpref } }); _tokenService = new Mock <ITokenServiceApiClient>(); _tokenService.Setup(x => x.GetPrivilegedAccessTokenAsync()).ReturnsAsync(new PrivilegedAccessToken { AccessCode = ExpectedAuthToken }); _hmrcService = new HmrcService(_configuration, _httpClientWrapper.Object, _apprenticeshipLevyApiClient.Object, _tokenService.Object, new NoopExecutionPolicy(), null, null, new Mock <ILog>().Object); }
public void Arrange() { _configuration = new HmrcConfiguration { BaseUrl = ExpectedBaseUrl, ClientId = ExpectedClientId, Scope = ExpectedScope, ClientSecret = ExpectedClientSecret }; _apprenticeshipLevyApiClient = new Mock <IApprenticeshipLevyApiClient>(); _httpClientWrapper = new Mock <IHttpClientWrapper>(); _apprenticeshipLevyApiClient.Setup(x => x.GetEmployerDetails(It.IsAny <string>(), It.IsAny <string>())) .ReturnsAsync(new EmpRefLevyInformation { Employer = new Employer { Name = new Name { EmprefAssociatedName = ExpectedName } }, Links = new Links() }); _tokenService = new Mock <ITokenServiceApiClient>(); _tokenService.Setup(x => x.GetPrivilegedAccessTokenAsync()).ReturnsAsync(new PrivilegedAccessToken { AccessCode = ExpectedAuthToken }); _hmrcService = new HmrcService(_configuration, _httpClientWrapper.Object, _apprenticeshipLevyApiClient.Object, _tokenService.Object, new NoopExecutionPolicy(), null, null, new Mock <ILog>().Object); }
public void Arrange() { _configuration = new HmrcConfiguration { BaseUrl = ExpectedBaseUrl, ClientId = ExpectedClientId, Scope = ExpectedScope, ClientSecret = ExpectedClientSecret, OgdSecret = "ABC1234FG", OgdClientId = ExpectedOgdClientId, AzureAppKey = "123TRG", AzureClientId = "TYG567", AzureResourceId = "Resource1", AzureTenant = "test", UseHiDataFeed = false }; _httpClientWrapper = new Mock <IHttpClientWrapper>(); _tokenService = new Mock <ITokenServiceApiClient>(); _tokenService.Setup(x => x.GetPrivilegedAccessTokenAsync()).ReturnsAsync(new PrivilegedAccessToken { AccessCode = ExpectedAuthToken }); _apprenticeshipLevyApiClient = new Mock <IApprenticeshipLevyApiClient>(); _azureAdAuthService = new Mock <IAzureAdAuthenticationService>(); _azureAdAuthService .Setup(x => x.GetAuthenticationResult( _configuration.AzureClientId, _configuration.AzureAppKey, _configuration.AzureResourceId, _configuration.AzureTenant)) .ReturnsAsync(ExpectedAuthToken); _hmrcService = new HmrcService(_configuration, _httpClientWrapper.Object, _apprenticeshipLevyApiClient.Object, _tokenService.Object, new NoopExecutionPolicy(), null, _azureAdAuthService.Object, new Mock <ILog>().Object); }
public void Arrange() { _configuration = new HmrcConfiguration { BaseUrl = ExpectedBaseUrl, ClientId = ExpectedClientId, Scope = ExpectedScope, ClientSecret = ExpectedClientSecret, OgdClientId = ExpectedOgdClientId, AzureAppKey = "123TRG", AzureClientId = "TYG567", AzureResourceId = "Resource1", AzureTenant = "test", UseHiDataFeed = false }; _httpClientWrapper = new Mock <IHttpClientWrapper>(); _httpClientWrapper.Setup(x => x.SendMessage("", $"oauth/token?client_secret={ExpectedTotpToken}&client_id={ExpectedOgdClientId}&grant_type=client_credentials&scopes=read:apprenticeship-levy")).ReturnsAsync(JsonConvert.SerializeObject(new HmrcTokenResponse { AccessToken = ExpectedAuthToken })); _tokenService = new Mock <ITokenServiceApiClient>(); _tokenService.Setup(x => x.GetPrivilegedAccessTokenAsync()).ReturnsAsync(new PrivilegedAccessToken { AccessCode = ExpectedAuthToken }); _apprenticeshipLevyApiClient = new Mock <IApprenticeshipLevyApiClient>(); _azureAdAuthService = new Mock <IAzureAdAuthenticationService>(); _azureAdAuthService.Setup(x => x.GetAuthenticationResult(_configuration.AzureClientId, _configuration.AzureAppKey, _configuration.AzureResourceId, _configuration.AzureTenant)) .ReturnsAsync(ExpectedAuthToken); _hmrcService = new HmrcService(_configuration, _httpClientWrapper.Object, _apprenticeshipLevyApiClient.Object, _tokenService.Object, new NoopExecutionPolicy(), null, _azureAdAuthService.Object, new Mock <ILog>().Object); }
public void Arrange() { _configuration = new HmrcConfiguration { BaseUrl = ExpectedBaseUrl, ClientId = ExpectedClientId, OgdClientId = ExpectedOgdClientId, Scope = ExpectedScope, ClientSecret = ExpectedClientSecret }; _httpClientWrapper = new Mock <IHttpClientWrapper>(); _httpClientWrapper.Setup(x => x.SendMessage(It.IsAny <object>(), It.IsAny <string>())).ReturnsAsync(JsonConvert.SerializeObject(new HmrcTokenResponse())); _tokenService = new Mock <ITokenServiceApiClient>(); _tokenService.Setup(x => x.GetPrivilegedAccessTokenAsync()).ReturnsAsync(new PrivilegedAccessToken { AccessCode = ExpectedAccessCode }); _apprenticeshipLevyApiClient = new Mock <IApprenticeshipLevyApiClient>(); _hmrcService = new HmrcService(_configuration, _httpClientWrapper.Object, _apprenticeshipLevyApiClient.Object, _tokenService.Object, new NoopExecutionPolicy(), null, null, new Mock <ILog>().Object); }