Example #1
0
 /// <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;
 }
Example #2
0
        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);
        }
Example #3
0
        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);
        }