/// <summary> /// Creates a new instance of a BestBetsController /// </summary> /// <param name="matchService">An IBestBetsMatchService for getting matched best bets categories</param> /// <param name="displayService">An IBestBetsDisplayService for getting the display HTML for matched categories</param> /// <param name="logger">A logger</param> public BestBetsController( IBestBetsMatchService matchService, IBestBetsDisplayService displayService, ILogger <BestBetsController> logger ) { this._matchService = matchService; this._displayService = displayService; this._logger = logger; }
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); }