コード例 #1
0
        public async Task Then_The_Ping_Endpoint_Is_Called_For_OuterApi(
            [Frozen] Mock <IApiClient> client,
            HealthCheckContext healthCheckContext,
            FatOuterApiHealthCheck healthCheck)
        {
            //Act
            await healthCheck.CheckHealthAsync(healthCheckContext, CancellationToken.None);

            //Assert
            client.Verify(x => x.Ping(), Times.Once);
        }
コード例 #2
0
        public async Task Then_If_It_Is_Not_Successful_An_Exception_Is_Thrown(
            [Frozen] Mock <IApiClient> client,
            HealthCheckContext healthCheckContext,
            FatOuterApiHealthCheck healthCheck)
        {
            //Arrange
            client.Setup(x => x.Ping())
            .ReturnsAsync(404);
            //Act
            var actual = await healthCheck.CheckHealthAsync(healthCheckContext, CancellationToken.None);

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