public async Task <IApprenticeshipLevyApiClient> GetLevyHttpClient() { var tokenService = new TokenServiceApiClient(_levySubmissionsApiConfiguration); var tokenResult = await tokenService.GetPrivilegedAccessTokenAsync(); var httpclient = ApprenticeshipLevyApiClient.CreateHttpClient(tokenResult.AccessCode, _hmrcApiBaseUrlConfig.HmrcApiBaseUrl); return(new ApprenticeshipLevyApiClient(httpclient)); }
public async Task CanUseGetEmploymentStatusEndpointWithNullFromAndToDate() { var stubresponse = new ObjectCreator().Create <EmploymentStatus>(x => { x.Employed = true; x.Empref = "111/ABC00001"; x.Nino = "AB956885B"; x.FromDate = new DateTime(2017, 12, 14); x.ToDate = new DateTime(2018, 02, 06); }); apiMessageHandlers.SetupGetEmploymentStatus(stubresponse, "111/ABC00001", "AB956885B"); using (HmrcApi webApi = new HmrcApi(apiMessageHandlers)) { using (HttpClient client = new HttpClient { BaseAddress = new Uri(baseAddress) }) { var hmrcclient = new ApprenticeshipLevyApiClient(client); var jsonresponse = await hmrcclient.GetEmploymentStatus("111/ABC00001", "AB956885B"); Assert.AreEqual(true, jsonresponse.Employed); } } }