public async Task Then_The_Ping_Endpoint_Is_Called( [Frozen] Mock <ILocationApiClient <LocationApiConfiguration> > client, HealthCheckContext healthCheckContext, LocationsApiHealthCheck healthCheck) { //Act await healthCheck.CheckHealthAsync(healthCheckContext, CancellationToken.None); //Assert client.Verify(x => x.GetResponseCode(It.IsAny <GetPingRequest>()), Times.Once); }
public async Task And_Not_Successful_Returns_UnHealthy( [Frozen] Mock <ILocationApiClient <LocationApiConfiguration> > client, HealthCheckContext healthCheckContext, LocationsApiHealthCheck 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); }
public async Task Then_If_It_Is_Successful_Returns_Healthy( [Frozen] Mock <ILocationApiClient <LocationApiConfiguration> > client, HealthCheckContext healthCheckContext, LocationsApiHealthCheck 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); }