public async Task Then_The_Ping_Endpoint_Is_Called_For_CoursesApi( [Frozen] Mock <ICoursesApiClient <CoursesApiConfiguration> > client, HealthCheckContext healthCheckContext, CoursesApiHealthCheck healthCheck) { //Act await healthCheck.CheckHealthAsync(healthCheckContext, CancellationToken.None); //Assert client.Verify(x => x.GetResponseCode(It.IsAny <GetPingRequest>()), Times.Once); }
public async Task And_CourseDeliveryApi_Ping_Not_Found_Then_Unhealthy( [Frozen] Mock <ICoursesApiClient <CoursesApiConfiguration> > client, HealthCheckContext healthCheckContext, CoursesApiHealthCheck 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_200_Is_Returned( [Frozen] Mock <ICoursesApiClient <CoursesApiConfiguration> > client, HealthCheckContext healthCheckContext, CoursesApiHealthCheck 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); }