Beispiel #1
0
        public async System.Threading.Tasks.Task GetAVsForMultipleProvidersTestAsync()
        {
            //Arrange
            var pageNumber = 1;
            var pageSize   = 5;
            var returnDiffrentProvidersOnPage = 2;

            A.CallTo(() => fakeApprenticeshipVacancyApi.GetAsync(A <string> ._, RequestType.Search)).Returns(AVAPIDummyResponses.GetDummyApprenticeshipVacancySummaryResponse(pageNumber, 50, pageSize, pageSize, returnDiffrentProvidersOnPage)).Once().
            Then.Returns(AVAPIDummyResponses.GetDummyApprenticeshipVacancySummaryResponse(pageNumber + 1, 50, pageSize, pageSize, returnDiffrentProvidersOnPage));

            var aVAPIService = new AVAPIService(fakeApprenticeshipVacancyApi, fakeLogger, aVAPIServiceSettings);

            //Act
            var aVSumaryList = await aVAPIService.GetAVsForMultipleProvidersAsync(aVMapping).ConfigureAwait(false);

            //Asserts
            //must have got more then 1 page to get multipe supplier
            aVSumaryList.Count().Should().BeGreaterThan(pageSize);

            var numberProviders = aVSumaryList.Select(v => v.TrainingProviderName).Distinct().Count();

            numberProviders.Should().BeGreaterThan(1);

            A.CallTo(() => fakeApprenticeshipVacancyApi.GetAsync(A <string> ._, RequestType.Search)).MustHaveHappenedTwiceExactly();
        }
Beispiel #2
0
        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();
        }
Beispiel #3
0
        public async Task GetAVSumaryPageTestAsync()
        {
            //arrange
            var pageNumber = 1;
            var pageSize   = 5;
            var returnDiffrentProvidersOnPage = 1;

            A.CallTo(() => fakeApprenticeshipVacancyApi.GetAsync(A <string> ._, RequestType.Search)).Returns(AVAPIDummyResponses.GetDummyApprenticeshipVacancySummaryResponse(pageNumber, 50, pageSize, pageSize, returnDiffrentProvidersOnPage));
            var aVAPIService = new AVAPIService(fakeApprenticeshipVacancyApi, fakeLogger, aVAPIServiceSettings);

            //Act
            var pageSumary = await aVAPIService.GetAVSumaryPageAsync(aVMapping, 1).ConfigureAwait(false);

            //Asserts
            pageSumary.CurrentPage.Should().Be(pageNumber);
            pageSumary.Results.Count().Should().Be(pageSize);

            A.CallTo(() => fakeApprenticeshipVacancyApi.GetAsync(A <string> ._, RequestType.Search)).MustHaveHappened();
        }
Beispiel #4
0
        public async Task GetApprenticeshipVacancyDetailsTestAsync()
        {
            //Arrange
            A.CallTo(() => fakeApprenticeshipVacancyApi.GetAsync(A <string> ._, RequestType.Apprenticeships)).Returns(AVAPIDummyResponses.GetDummyApprenticeshipVacancyDetailsResponse());

            var aVAPIService = new AVAPIService(fakeApprenticeshipVacancyApi, fakeLogger, aVAPIServiceSettings);

            //Act
            var vacancyDetails = await aVAPIService.GetApprenticeshipVacancyDetailsAsync(123).ConfigureAwait(false);

            //Asserts
            vacancyDetails.Should().NotBeNull();
            vacancyDetails.VacancyReference.Should().Be(123);

            A.CallTo(() => fakeApprenticeshipVacancyApi.GetAsync(A <string> ._, RequestType.Apprenticeships)).MustHaveHappened();
        }