Ejemplo n.º 1
0
        public async System.Threading.Tasks.Task GetSitefinityHealthStatusAsync()
        {
            var fakeSocSitefinityOdataRepository = A.Fake <ISocSitefinityOdataRepository>();
            var fakeAVService         = A.Fake <IAVService>();
            var fakeApplicationLogger = A.Fake <IApplicationLogger>();

            var getAvServiceHealthStatus = new GetAvServiceHealthStatus(fakeSocSitefinityOdataRepository, fakeAVService, fakeApplicationLogger);

            var result = await getAvServiceHealthStatus.GetSitefinityHealthStatusAsync();

            result.Status.Should().Be(ServiceState.Green);

            A.CallTo(() => fakeSocSitefinityOdataRepository.GetAllAsync(A <bool> ._)).ThrowsAsync(new Exception("Fake Exception"));
            result = await getAvServiceHealthStatus.GetSitefinityHealthStatusAsync();

            result.Status.Should().Be(ServiceState.Red);
        }
Ejemplo n.º 2
0
        public async System.Threading.Tasks.Task GetServiceHealthStateAsync()
        {
            var fakeSocSitefinityOdataRepository = A.Fake <ISocSitefinityOdataRepository>();
            var fakeAVService         = A.Fake <IAVService>();
            var fakeApplicationLogger = A.Fake <IApplicationLogger>();

            //Set up calls
            A.CallTo(() => fakeAVService.GetAVSumaryPageAsync(A <SocMapping> ._, 1)).Returns(DummyTestResponses.GetDummyApprenticeshipVacancySummaryResponse());
            A.CallTo(() => fakeAVService.GetApprenticeshipVacancyDetailsAsync(A <string> ._)).Returns(new ApprenticeshipVacancyDetails());

            var getAvServiceHealthStatus = new GetAvServiceHealthStatus(fakeSocSitefinityOdataRepository, fakeAVService, fakeApplicationLogger);

            var result = await getAvServiceHealthStatus.GetServiceHealthStateAsync();

            result.ApplicationStatus.Should().Be(HttpStatusCode.OK);

            A.CallTo(() => fakeAVService.GetAVSumaryPageAsync(A <SocMapping> ._, 1)).ThrowsAsync(new Exception("Fake Exception"));
            result = await getAvServiceHealthStatus.GetServiceHealthStateAsync();

            result.ApplicationStatus.Should().Be(HttpStatusCode.BadGateway);
        }