public void AuthorizationHealthcheck_ReturnsNoContent() { HealthcheckController controller = new HealthcheckController(null); NoContentResult result = controller.GetAuthorizationStatus() as NoContentResult; Assert.That(result, Is.Not.Null); }
public async Task ShouldGetRepositoryToReturnHealth() { var healthcheckController = new HealthcheckController(_healthCheckRepository.Object); await healthcheckController.Index(); _healthCheckRepository.Verify(x => x.Get(), Times.Once); }
public void HealthCheck_HealthyService_ReturnsOk() { Mock <IServiceHealthProvider> healthProvider = new Mock <IServiceHealthProvider>(); healthProvider.Setup(m => m.IsDatabaseConnected()).Returns(true); HealthcheckController controller = new HealthcheckController(healthProvider.Object); OkResult result = controller.GetHealthcheck() as OkResult; Assert.That(result, Is.Not.Null); }
public void Healthcheck_DatabaseFailure_ReturnsInternalServerError() { Mock <IServiceHealthProvider> healthProvider = new Mock <IServiceHealthProvider>(); healthProvider.Setup(m => m.IsDatabaseConnected()).Returns(false); HealthcheckController controller = new HealthcheckController(healthProvider.Object); ObjectResult result = controller.GetHealthcheck() as ObjectResult; Assert.Multiple(() => { Assert.That(result, Is.Not.Null); Assert.That(result.StatusCode, Is.EqualTo(StatusCodes.Status500InternalServerError)); }); }
public HealthcheckControllerTests() { _mockHealthCheckService = new Mock <IHealthCheckService>(); _classUnderTest = new HealthcheckController(_mockHealthCheckService.Object); }
public HealthcheckTest() { var controller = new HealthcheckController(); result = controller.Healthcheck() as OkObjectResult; }