/// <summary> /// /// </summary> /// <param name="apiBaseUrl"></param> /// <param name="primarySubscriptionKey"></param> /// <param name="secondarySubscriptionKey"></param> public FantasyDataClient(string primarySubscriptionKey, string secondarySubscriptionKey) { Uri statApiBaseUrl = NFLConfig.StateApiBaseUrl; Uri scoreApiBaseUrl = NFLConfig.ScoreApiBaseUrl; Uri ProjectionApiBaseUrl = NFLConfig.ProjectionApiBaseUrl; DailyFantasyService = new DailyFantasyService(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); SeasonService = new SeasonService(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); NewsService = new NewsService(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); PlayerGameStatService = new PlayerGameStatService(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); PlayerSeasonStatService = new PlayerSeasonStatService(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); TeamDefenseService = new TeamDefenseService(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); GameService = new GameService(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); InjuryService = new InjuryService(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); StadiumService = new StadiumService(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); TeamService = new TeamService(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); BoxScoreService = new BoxScoreService(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); PlayerService = new PlayerService(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); ScheduleService = new ScheduleService(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); TimeFrameService = new TimeFrameService(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); TeamSeasonService = new TeamSeasonService(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); TeamGameService = new TeamGameService(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); ScoresService = new ScoresService(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); ScoresService = new ScoresService(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); DfsSlateService = new DfsSlateService(ProjectionApiBaseUrl.AbsoluteUri, NFLConfig.ProjectionPrimarySubscriptionKey, NFLConfig.ProjectionSecondarySubscriptionKey); PlayerGameProjectionsService = new PlayerGameProjectionService(ProjectionApiBaseUrl.AbsoluteUri, NFLConfig.ProjectionPrimarySubscriptionKey, NFLConfig.ProjectionSecondarySubscriptionKey); PlayerSeasonProjectionService = new PlayerSeasonProjectionService(ProjectionApiBaseUrl.AbsoluteUri, NFLConfig.ProjectionPrimarySubscriptionKey, NFLConfig.ProjectionSecondarySubscriptionKey); }
public async Task <ActionResult> Index() { ScoresService serv = new ScoresService(); var players = await serv.GetPlayers(); return(View(players)); }
private void SaveScores() { var scoreView = Activity.FindViewById <TextView>(Resource.Id.scoreValue); var score = int.Parse(scoreView.Text); User.RaceMaxScore = score; ScoresService.SaveScore(User); }
public async Task <ActionResult> About() { ViewBag.Message = "Your application description page."; ScoresService serv = new ScoresService(); var player = await serv.GetPlayerByID(3); return(View(player)); }
private void InitScores(GameType type) { var scores = ScoresService.GetScores(type); var scoresText = CreateScoreText(scores); var scoresTextView = Activity.FindViewById <TextView>(Resource.Id.scores_scoresList); scoresTextView.Text = scoresText; }
public void TestCalculateScore() { var service = new ScoresService(); var evaluation = Samples.CompleteEvaluation; var expected = 15; var actualEvaluation = service.CalculateScore(evaluation); var actual = actualEvaluation.Score; Assert.Equal(expected, actual); }
public async Task UpdateScore_When_Payload_Is_Null_Then_Throw_Exception() { var repository = Mock.Of <IScoresRepository>(); var service = new ScoresService(_mapper, repository); Func <Task> act = async() => { await service.UpdateScore("Dave", null); }; await act.Should() .ThrowAsync <Exception>() .WithMessage("Value cannot be null. (Parameter 'payload is required')"); }
public AdminManagementController(GardenLinkContext db, GardensService gardensService, LeasingsService leasingsService, PaymentsService paymentsService, ScoresService scoresService, UsersService usersService, WalletsService walletsService) { this.db = db; this.gardensService = gardensService; this.leasingsService = leasingsService; this.paymentsService = paymentsService; this.scoresService = scoresService; this.usersService = usersService; this.walletsService = walletsService; }
public ScoresServiceTests() { var unitOfWorkMock = new Mock <IUnitOfWork>(); unitOfWorkMock .SetupGet(uow => uow.Games) .Returns(GetGameRepositoryMock()); unitOfWorkMock .SetupGet(uow => uow.Scores) .Returns(GetScoreRepositoryMock()); unitOfWorkMock .SetupGet(uow => uow.Leagues) .Returns(GetLeagueRepositoryMock()); unitOfWorkMock .SetupGet(uow => uow.Teams) .Returns(GetTeamsRepositoryMock()); unitOfWorkMock .SetupGet(uow => uow.MatchDays) .Returns(GetMatchDayRepositoryMock()); var groupServiceMock = new Mock <IGroupService>(); groupServiceMock .Setup(gs => gs.GetLeagueName(It.Is <int>(id => id == 1))) .Returns("Champions League 2017/18"); var filters = Mocks.GetFilters(); var filterFactoryMock = new Mock <IFilterFactory <Game> >(); filterFactoryMock .Setup(ff => ff.Create(It.Is <Filter>(f => f.Name == FilterType.StartDate))) .Returns(filters[0]); filterFactoryMock .Setup(ff => ff.Create(It.Is <Filter>(f => f.Name == FilterType.EndDate))) .Returns(filters[1]); filterFactoryMock .Setup(ff => ff.Create(It.Is <Filter>(f => f.Name == FilterType.Group))) .Returns(filters[2]); filterFactoryMock .Setup(ff => ff.Create(It.Is <Filter>(f => f.Name == FilterType.Team))) .Returns(filters[3]); service = new ScoresService(unitOfWorkMock.Object, groupServiceMock.Object, filterFactoryMock.Object); }
public async Task GetScoresGreaterThan_Throws_Exception() { var number = 10; var repository = Mock.Of <IScoresRepository>( x => x.GetScores() == Task.FromException <IList <ScoreModel> >(new Exception("Custom Test Exception"))); var service = new ScoresService(_mapper, repository); Func <Task> act = async() => { await service.GetScoresGreaterThan(number); }; await act.Should() .ThrowAsync <Exception>() .WithMessage("Custom Test Exception"); }
public async Task UpdateScore_Does_Not_Throw_Exception() { var player = "Dave"; var score = 100; var repository = Mock.Of <IScoresRepository>( x => x.UpdateScore(It.Is <ScoreModel>(o => o.Player == player && o.Score == score)) == Task.CompletedTask); var service = new ScoresService(_mapper, repository); Func <Task> act = async() => { await service.UpdateScore(player, new ScoresRequest { Score = score }); }; await act.Should() .NotThrowAsync <Exception>(); }
public async Task UpdateScore_Throws_Exception() { var player = "Dave"; var score = 100; var repository = Mock.Of <IScoresRepository>( x => x.UpdateScore(It.Is <ScoreModel>(o => o.Player == player && o.Score == score)) == Task.FromException <IList <ScoreModel> >(new Exception("Custom Test Exception"))); var service = new ScoresService(_mapper, repository); Func <Task> act = async() => { await service.UpdateScore(player, new ScoresRequest { Score = score }); }; await act.Should() .ThrowAsync <Exception>() .WithMessage("Custom Test Exception"); }
public async Task GetScoresGreaterThan() { var number = 10; var stub = new List <ScoreModel> { new ScoreModel { Player = "Dave", Score = 100 } }; var repository = Mock.Of <IScoresRepository>( x => x.GetScores() == Task.FromResult <IList <ScoreModel> >(stub)); var service = new ScoresService(_mapper, repository); var expected = _mapper.Map <IList <ScoreModel>, IList <ScoresResponse> >(stub); var actual = await service.GetScoresGreaterThan(number); actual.Should().BeEquivalentTo(expected); }
public ScoresController(ScoresService service) { this.service = service; }
/// <summary> /// Constructor /// </summary> /// <param name="scoresService"></param> public ScoresController(ScoresService <ScoresViewModel, Score> scoresService) { _scoresService = scoresService; }