public async void IsHealthy_Healthy() { IBestBetsDisplayService displayService = null; IBestBetsMatchService matchService = null; IHealthCheckService healthService = GetMockedHealthSvc <IHealthCheckService>(true); // Create instance of controller BestBetsController controller = new BestBetsController( matchService, displayService, healthService, NullLogger <BestBetsController> .Instance ); var actual = await controller.GetStatus(); Assert.Equal(BestBetsController.HEALTHY_STATUS, actual, ignoreCase: true); }
public async void IsHealthy_Unhealthy() { IBestBetsDisplayService displayService = null; IBestBetsMatchService matchService = null; IHealthCheckService healthService = GetMockedHealthSvc <IHealthCheckService>(false); // Create instance of controller BestBetsController controller = new BestBetsController( matchService, displayService, healthService, NullLogger <BestBetsController> .Instance ); // If the health check service is unhealthy, verify that GetStatus() throws APIErrorException // with a status of 500. APIErrorException ex = await Assert.ThrowsAsync <APIErrorException>(() => controller.GetStatus()); Assert.Equal(500, ex.HttpStatusCode); }