예제 #1
0
        /// <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);
        }
예제 #2
0
        public async Task <ActionResult> Index()
        {
            ScoresService serv    = new ScoresService();
            var           players = await serv.GetPlayers();

            return(View(players));
        }
예제 #3
0
        private void SaveScores()
        {
            var scoreView = Activity.FindViewById <TextView>(Resource.Id.scoreValue);
            var score     = int.Parse(scoreView.Text);

            User.RaceMaxScore = score;
            ScoresService.SaveScore(User);
        }
예제 #4
0
        public async Task <ActionResult> About()
        {
            ViewBag.Message = "Your application description page.";

            ScoresService serv   = new ScoresService();
            var           player = await serv.GetPlayerByID(3);

            return(View(player));
        }
예제 #5
0
        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;
        }
예제 #6
0
        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);
        }
예제 #7
0
        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')");
        }
예제 #8
0
 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;
 }
예제 #9
0
        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);
        }
예제 #10
0
        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");
        }
예제 #11
0
        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>();
        }
예제 #12
0
        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");
        }
예제 #13
0
        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);
        }
예제 #14
0
 public ScoresController(ScoresService service)
 {
     this.service = service;
 }
예제 #15
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="scoresService"></param>
 public ScoresController(ScoresService <ScoresViewModel, Score> scoresService)
 {
     _scoresService = scoresService;
 }