public void GetCurrentHealthStatusAsyncExceptionTestAsync() { //Arrange A.CallTo(() => fakeApprenticeshipVacancyApi.GetAsync(A <string> ._, RequestType.Search)).Throws(new ApplicationException()); var aVAPIService = new AVAPIService(fakeApprenticeshipVacancyApi, fakeLogger, aVAPIServiceSettings); //Act Func <Task> serviceHealthStatus = async() => await aVAPIService.CheckHealthAsync(dummyHealthCheckContext).ConfigureAwait(false); //Asserts serviceHealthStatus.Should().Throw <Exception>(); }
public async Task GetCurrentHealthStatusAsyncTestAsync(int recordsToReturn, HealthStatus expectedStatus) { //Arrange var pageNumber = 1; var pageSize = 5; var returnDiffrentProvidersOnPage = 1; A.CallTo(() => fakeApprenticeshipVacancyApi.GetAsync(A <string> ._, RequestType.Search)).Returns(AVAPIDummyResponses.GetDummyApprenticeshipVacancySummaryResponse(pageNumber, pageSize, recordsToReturn, pageSize, returnDiffrentProvidersOnPage)); aVAPIServiceSettings.StandardsForHealthCheck = A.Dummy <string>(); var aVAPIService = new AVAPIService(fakeApprenticeshipVacancyApi, fakeLogger, aVAPIServiceSettings); //Act var serviceHealthStatus = await aVAPIService.CheckHealthAsync(dummyHealthCheckContext).ConfigureAwait(false); //Asserts serviceHealthStatus.Status.Should().Be(expectedStatus); A.CallTo(() => fakeApprenticeshipVacancyApi.GetAsync(A <string> ._, RequestType.Search)).MustHaveHappened(); }