public void UnreleasedGameTest()
        {
            Instant       pickupTime      = InstantPattern.ExtendedIso.Parse("2018-01-02T12:34:24Z").GetValueOrThrow();
            Instant       nowTime         = InstantPattern.ExtendedIso.Parse("2018-08-02T12:34:24Z").GetValueOrThrow();
            IClock        fakeClock       = new FakeClock(nowTime);
            ScoringSystem standardScoring = ScoringSystem.GetScoringSystem("Standard");

            MasterGame    masterGame = new MasterGame(Guid.NewGuid(), "", "", new LocalDate(2018, 10, 20), null, null, 2018, StandardEligibilityLevel, false, false, "");
            PublisherGame testGame   = new PublisherGame(Guid.NewGuid(), "", pickupTime, false, null, null, new MasterGameYear(masterGame, 2018), null, null, 2018);

            decimal?fantasyPoints = standardScoring.GetPointsForGame(testGame, fakeClock, leagueWideValues);

            Assert.AreEqual(null, fantasyPoints);
        }
Esempio n. 2
0
        public static List <LeagueYear> GetLeagueYears()
        {
            var leagues = GetLeagues();
            List <LeagueYear> leagueYears = new List <LeagueYear>();

            foreach (var league in leagues)
            {
                var        eligibilityOverrides = new List <EligibilityOverride>();
                LeagueYear year = new LeagueYear(league, 2019, new LeagueOptions(12, 6, 1, 2, -1, 0, false, false, 0, new List <LeagueTagStatus>(), DraftSystem.Flexible, PickupSystem.Budget,
                                                                                 ScoringSystem.GetScoringSystem("Standard"), true), PlayStatus.DraftFinal, eligibilityOverrides, Instant.FromUtc(2019, 1, 5, 12, 0, 0));
                leagueYears.Add(year);
            }

            return(leagueYears);
        }
        public void UnreleasedGameTest()
        {
            Instant       pickupTime          = InstantPattern.ExtendedIso.Parse("2018-01-02T12:34:24Z").GetValueOrThrow();
            Instant       nowTime             = InstantPattern.ExtendedIso.Parse("2018-08-02T12:34:24Z").GetValueOrThrow();
            IClock        fakeClock           = new FakeClock(nowTime);
            ScoringSystem standardScoring     = ScoringSystem.GetScoringSystem("Standard");
            var           eligibilitySettings = new EligibilitySettings(StandardEligibilityLevel, false, false, false, false, false);

            MasterGame masterGame = new MasterGame(Guid.NewGuid(), "", "", new LocalDate(2018, 10, 20), new LocalDate(2018, 10, 20), null, null, new LocalDate(2018, 1, 1), eligibilitySettings, "",
                                                   fakeClock.GetCurrentInstant(), false, false, fakeClock.GetCurrentInstant());
            PublisherGame testGame = new PublisherGame(Guid.NewGuid(), Guid.NewGuid(), "", pickupTime, false, null, null, new MasterGameYear(masterGame, 2018), null, null);

            decimal?fantasyPoints = testGame.CalculateFantasyPoints(standardScoring, fakeClock);

            Assert.AreEqual(null, fantasyPoints);
        }
        public void Under70ScoreTest()
        {
            Instant       pickupTime      = InstantPattern.ExtendedIso.Parse("2018-01-02T12:34:24Z").GetValueOrThrow();
            Instant       nowTime         = InstantPattern.ExtendedIso.Parse("2018-08-02T12:34:24Z").GetValueOrThrow();
            IClock        fakeClock       = new FakeClock(nowTime);
            ScoringSystem standardScoring = ScoringSystem.GetScoringSystem("Standard");

            MasterGame masterGame = new MasterGame(Guid.NewGuid(), "", "",
                                                   new LocalDate(2018, 4, 20), new LocalDate(2018, 4, 20), null, null, new LocalDate(2018, 4, 20),
                                                   null, 65.8559m, "", "", fakeClock.GetCurrentInstant(), false, false, false,
                                                   fakeClock.GetCurrentInstant(), new List <MasterSubGame>(), new List <MasterGameTag>());

            PublisherGame testGame = new PublisherGame(Guid.NewGuid(), Guid.NewGuid(), "", pickupTime, false, null, false, null, new MasterGameYear(masterGame, 2018), null, null);

            decimal?fantasyPoints = testGame.CalculateFantasyPoints(standardScoring, fakeClock);

            Assert.AreEqual(-4.1441m, fantasyPoints);
        }
        public void ManualScoreTest()
        {
            Instant       pickupTime         = InstantPattern.ExtendedIso.Parse("2018-01-02T12:34:24Z").GetValueOrThrow();
            Instant       nowTime            = InstantPattern.ExtendedIso.Parse("2018-08-02T12:34:24Z").GetValueOrThrow();
            IClock        fakeClock          = new FakeClock(nowTime);
            ScoringSystem diminishingScoring = ScoringSystem.GetScoringSystem("Diminishing");

            MasterGame masterGame = new MasterGame(Guid.NewGuid(), "", "",
                                                   new LocalDate(2018, 7, 13), new LocalDate(2018, 7, 13), null, null, new LocalDate(2018, 7, 13),
                                                   null, 84.8095m, "", "", fakeClock.GetCurrentInstant(), false, false, false,
                                                   fakeClock.GetCurrentInstant(), new List <MasterSubGame>(), new List <MasterGameTag>());

            PublisherGame testGame = new PublisherGame(Guid.NewGuid(), Guid.NewGuid(), "", pickupTime, false, 83.8095m, false, null, new MasterGameYear(masterGame, 2018), null, null);

            decimal?fantasyPoints = testGame.CalculateFantasyPoints(diminishingScoring, fakeClock);

            Assert.AreEqual(13.8095m, fantasyPoints);
        }
Esempio n. 6
0
        public static List <LeagueYear> GetLeagueYears()
        {
            var leagues                   = GetLeagues();
            var eligibilityLevel          = EligibilityLevelFactory.GetEligibilityLevels().Single(x => x.Level == 0);
            List <LeagueYear> leagueYears = new List <LeagueYear>();

            foreach (var league in leagues)
            {
                var        eligibilitySettings  = new EligibilitySettings(eligibilityLevel, true, false, true, false, false);
                var        eligibilityOverrides = new List <EligibilityOverride>();
                LeagueYear year = new LeagueYear(league, 2019, new LeagueOptions(12, 6, 1, 2, -1, 0, false, eligibilitySettings, DraftSystem.Flexible,
                                                                                 PickupSystem.Budget, ScoringSystem.GetScoringSystem("Standard"), true), PlayStatus.DraftFinal, eligibilityOverrides);
                leagueYears.Add(year);
            }

            return(leagueYears);
        }