Exemplo 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);
        }
Exemplo 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);
        }
Exemplo 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);
        }