Esempio n. 1
0
        public async Task Then_The_Ping_Endpoint_Is_Called_For_EmployerDemandApi(
            [Frozen] Mock <IEmployerDemandApiClient <EmployerDemandApiConfiguration> > client,
            HealthCheckContext healthCheckContext,
            EmployerDemandApiHealthCheck healthCheck)
        {
            //Act
            await healthCheck.CheckHealthAsync(healthCheckContext, CancellationToken.None);

            //Assert
            client.Verify(x => x.GetResponseCode(It.IsAny <GetPingRequest>()), Times.Once);
        }
Esempio n. 2
0
        public async Task And_EmployerDemandApi_Ping_Not_Found_Then_Unhealthy(
            [Frozen] Mock <IEmployerDemandApiClient <EmployerDemandApiConfiguration> > client,
            HealthCheckContext healthCheckContext,
            EmployerDemandApiHealthCheck healthCheck)
        {
            //Arrange
            client.Setup(x => x.GetResponseCode(new GetPingRequest()))
            .ReturnsAsync(HttpStatusCode.NotFound);
            //Act
            var actual = await healthCheck.CheckHealthAsync(healthCheckContext, CancellationToken.None);

            //Assert
            Assert.AreEqual(HealthStatus.Unhealthy, actual.Status);
        }
Esempio n. 3
0
        public async Task Then_If_It_Is_Successful_200_Is_Returned(
            [Frozen] Mock <IEmployerDemandApiClient <EmployerDemandApiConfiguration> > client,
            HealthCheckContext healthCheckContext,
            EmployerDemandApiHealthCheck healthCheck)
        {
            //Arrange
            client.Setup(x => x.GetResponseCode(It.IsAny <GetPingRequest>()))
            .ReturnsAsync(HttpStatusCode.OK);
            //Act
            var actual = await healthCheck.CheckHealthAsync(healthCheckContext, CancellationToken.None);

            //Assert
            Assert.AreEqual(HealthStatus.Healthy, actual.Status);
        }