コード例 #1
0
    public void PreviouslyUnannouncedGameFailsSlotConditions()
    {
        Instant acquisitionTime = InstantPattern.ExtendedIso.Parse("2022-01-26T20:49:24Z").GetValueOrThrow();
        var     acquisitionDate = acquisitionTime.ToEasternDate();

        MasterGame masterGame = CreateComplexMasterGame("Star Wars Jedi: Fallen Order 2", new LocalDate(2022, 1, 27), null,
                                                        null, null, new LocalDate(2022, 1, 25), new List <MasterGameTag>()
        {
            _tagDictionary["NG"],
        });

        var leagueTags = new List <LeagueTagStatus>()
        {
            new LeagueTagStatus(_tagDictionary["PRT"], TagStatus.Banned),
            new LeagueTagStatus(_tagDictionary["C-EA"], TagStatus.Banned),
            new LeagueTagStatus(_tagDictionary["R-INT"], TagStatus.Banned),
        };

        var slotTags = new List <LeagueTagStatus>()
        {
            new LeagueTagStatus(_tagDictionary["RMKE"], TagStatus.Required)
        };

        var claimErrors = LeagueTagExtensions.GameHasValidTags(leagueTags, slotTags, masterGame, masterGame.Tags, acquisitionDate);

        Assert.AreEqual(1, claimErrors.Count);
        Assert.AreEqual("That game is not eligible because it does not have any of the following required tags: (Remake)", claimErrors[0].Error);
    }
コード例 #2
0
    public void PreviouslyUnannouncedRemakeEligible()
    {
        Instant acquisitionTime = InstantPattern.ExtendedIso.Parse("2022-01-29T20:49:24Z").GetValueOrThrow();
        var     acquisitionDate = acquisitionTime.ToEasternDate();

        MasterGame masterGame = CreateComplexMasterGame("The Last of Us Remake", new LocalDate(2022, 2, 3), null,
                                                        null, null, new LocalDate(2022, 2, 2), new List <MasterGameTag>()
        {
            _tagDictionary["RMKE"],
        });

        var leagueTags = new List <LeagueTagStatus>()
        {
            new LeagueTagStatus(_tagDictionary["PRT"], TagStatus.Banned),
            new LeagueTagStatus(_tagDictionary["C-EA"], TagStatus.Banned),
            new LeagueTagStatus(_tagDictionary["R-INT"], TagStatus.Banned),
        };

        var slotTags = new List <LeagueTagStatus>()
        {
            new LeagueTagStatus(_tagDictionary["RMKE"], TagStatus.Required)
        };

        var claimErrors = LeagueTagExtensions.GameHasValidTags(leagueTags, slotTags, masterGame, masterGame.Tags, acquisitionDate);

        Assert.AreEqual(0, claimErrors.Count);
    }
コード例 #3
0
    public void PreviouslyUnannouncedLeagueBannedEligible()
    {
        Instant acquisitionTime = InstantPattern.ExtendedIso.Parse("2022-01-05T20:49:24Z").GetValueOrThrow();
        var     acquisitionDate = acquisitionTime.ToEasternDate();

        MasterGame masterGame = CreateComplexMasterGame("Star Wars Jedi: Fallen Order 2", new LocalDate(2022, 1, 27), null,
                                                        null, null, new LocalDate(2022, 1, 25), new List <MasterGameTag>()
        {
            _tagDictionary["NG"],
        });

        var leagueTags = new List <LeagueTagStatus>()
        {
            new LeagueTagStatus(_tagDictionary["PRT"], TagStatus.Banned),
            new LeagueTagStatus(_tagDictionary["C-EA"], TagStatus.Banned),
            new LeagueTagStatus(_tagDictionary["R-INT"], TagStatus.Banned),
            new LeagueTagStatus(_tagDictionary["UNA"], TagStatus.Banned),
        };

        var slotTags = new List <LeagueTagStatus>()
        {
        };

        var claimErrors = LeagueTagExtensions.GameHasValidTags(leagueTags, slotTags, masterGame, masterGame.Tags, acquisitionDate);

        Assert.AreEqual(0, claimErrors.Count);
    }
コード例 #4
0
    public void UnannouncedRemakeInEligible()
    {
        Instant acquisitionTime = InstantPattern.ExtendedIso.Parse("2022-01-05T20:49:24Z").GetValueOrThrow();
        var     acquisitionDate = acquisitionTime.ToEasternDate();

        MasterGame masterGame = CreateComplexMasterGame("The Last of Us Remake", new LocalDate(2022, 1, 27), null,
                                                        null, null, null, new List <MasterGameTag>()
        {
            _tagDictionary["RMKE"],
            _tagDictionary["UNA"]
        });

        var leagueTags = new List <LeagueTagStatus>()
        {
            new LeagueTagStatus(_tagDictionary["PRT"], TagStatus.Banned),
            new LeagueTagStatus(_tagDictionary["C-EA"], TagStatus.Banned),
            new LeagueTagStatus(_tagDictionary["R-INT"], TagStatus.Banned),
            new LeagueTagStatus(_tagDictionary["RMKE"], TagStatus.Banned)
        };

        var slotTags = new List <LeagueTagStatus>()
        {
        };

        var claimErrors = LeagueTagExtensions.GameHasValidTags(leagueTags, slotTags, masterGame, masterGame.Tags, acquisitionDate);

        Assert.AreEqual(1, claimErrors.Count);
        Assert.AreEqual("That game is not eligible because the Remake tag has been banned", claimErrors[0].Error);
    }
コード例 #5
0
    public void EarlyAccessReleasedInternationallyComplexSlotEligible()
    {
        Instant acquisitionTime = InstantPattern.ExtendedIso.Parse("2022-01-31T20:49:24Z").GetValueOrThrow();
        var     acquisitionDate = acquisitionTime.ToEasternDate();

        MasterGame masterGame = CreateComplexMasterGame("Baldur's Gate 3", new LocalDate(2022, 1, 3), null,
                                                        new LocalDate(2020, 10, 6), null, null, new List <MasterGameTag>()
        {
            _tagDictionary["NG"],
            _tagDictionary["C-EA"],
        });

        var leagueTags = new List <LeagueTagStatus>()
        {
            new LeagueTagStatus(_tagDictionary["PRT"], TagStatus.Banned),
            new LeagueTagStatus(_tagDictionary["C-EA"], TagStatus.Banned),
            new LeagueTagStatus(_tagDictionary["R-INT"], TagStatus.Banned),
        };

        var slotTags = new List <LeagueTagStatus>()
        {
            new LeagueTagStatus(_tagDictionary["C-EA"], TagStatus.Required),
            new LeagueTagStatus(_tagDictionary["R-INT"], TagStatus.Required),
            new LeagueTagStatus(_tagDictionary["NG"], TagStatus.Required),
            new LeagueTagStatus(_tagDictionary["NGF"], TagStatus.Required),
        };

        var claimErrors = LeagueTagExtensions.GameHasValidTags(leagueTags, slotTags, masterGame, masterGame.Tags, acquisitionDate);

        Assert.AreEqual(0, claimErrors.Count);
    }
コード例 #6
0
    public void EarlyAccessHasGameAfterEarlyAccessInEligible()
    {
        Instant acquisitionTime = InstantPattern.ExtendedIso.Parse("2022-03-10T20:49:24Z").GetValueOrThrow();
        var     acquisitionDate = acquisitionTime.ToEasternDate();

        MasterGame masterGame = CreateComplexMasterGame("Have a Nice Death", new LocalDate(2022, 1, 3), null,
                                                        new LocalDate(2022, 3, 6), null, null, new List <MasterGameTag>()
        {
            _tagDictionary["NG"],
            _tagDictionary["C-EA"],
        });

        var leagueTags = new List <LeagueTagStatus>()
        {
            new LeagueTagStatus(_tagDictionary["PRT"], TagStatus.Banned),
            new LeagueTagStatus(_tagDictionary["C-EA"], TagStatus.Banned),
        };

        var slotTags = new List <LeagueTagStatus>();

        var claimErrors = LeagueTagExtensions.GameHasValidTags(leagueTags, slotTags, masterGame, masterGame.Tags, acquisitionDate);

        Assert.AreEqual(1, claimErrors.Count);
        Assert.AreEqual("That game is not eligible because the Currently in Early Access tag has been banned", claimErrors[0].Error);
    }
コード例 #7
0
    public void SimpleEligibleTest()
    {
        Instant acquisitionTime = InstantPattern.ExtendedIso.Parse("2022-01-31T20:49:24Z").GetValueOrThrow();
        var     acquisitionDate = acquisitionTime.ToEasternDate();

        MasterGame masterGame = CreateBasicMasterGame("Elden Ring", new LocalDate(2022, 2, 25), _tagDictionary["NGF"]);

        var leagueTags = new List <LeagueTagStatus>()
        {
            new LeagueTagStatus(_tagDictionary["PRT"], TagStatus.Banned)
        };

        var slotTags = new List <LeagueTagStatus>();

        var claimErrors = LeagueTagExtensions.GameHasValidTags(leagueTags, slotTags, masterGame, masterGame.Tags, acquisitionDate);

        Assert.AreEqual(0, claimErrors.Count);
    }
コード例 #8
0
    public PossibleMasterGameYear GetPossibleMasterGameYear(MasterGameYear masterGame, IReadOnlyList <PublisherSlot> openNonCounterPickSlots,
                                                            HashSet <MasterGame> publisherStandardMasterGames, HashSet <MasterGame> myPublisherMasterGames,
                                                            MasterGameWithEligibilityFactors eligibilityFactors, IEnumerable <LeagueTagStatus> tagsForSlot, LocalDate currentDate)
    {
        var  tagsToUse            = eligibilityFactors.TagOverrides.Any() ? eligibilityFactors.TagOverrides : masterGame.MasterGame.Tags;
        var  claimErrors          = LeagueTagExtensions.GameHasValidTags(tagsForSlot, new List <LeagueTagStatus>(), masterGame.MasterGame, tagsToUse, currentDate);
        bool isEligible           = !claimErrors.Any();
        bool taken                = publisherStandardMasterGames.Contains(masterGame.MasterGame);
        bool alreadyOwned         = myPublisherMasterGames.Contains(masterGame.MasterGame);
        bool isReleased           = masterGame.MasterGame.IsReleased(currentDate);
        bool willRelease          = masterGame.WillRelease();
        bool hasScore             = masterGame.MasterGame.CriticScore.HasValue;
        bool isEligibleInOpenSlot = SlotEligibilityService.GameIsEligibleInOpenSlot(openNonCounterPickSlots, eligibilityFactors);

        PossibleMasterGameYear possibleMasterGame = new PossibleMasterGameYear(masterGame, taken, alreadyOwned, isEligible, isEligibleInOpenSlot, isReleased, willRelease, hasScore);

        return(possibleMasterGame);
    }
コード例 #9
0
    public void SimpleInEligibleTest()
    {
        Instant acquisitionTime = InstantPattern.ExtendedIso.Parse("2022-01-31T20:49:24Z").GetValueOrThrow();
        var     acquisitionDate = acquisitionTime.ToEasternDate();

        MasterGame masterGame = CreateBasicMasterGame("GTA 5 (PS5)", new LocalDate(2022, 2, 25), _tagDictionary["PRT"]);

        var leagueTags = new List <LeagueTagStatus>()
        {
            new LeagueTagStatus(_tagDictionary["PRT"], TagStatus.Banned)
        };

        var slotTags = new List <LeagueTagStatus>();

        var claimErrors = LeagueTagExtensions.GameHasValidTags(leagueTags, slotTags, masterGame, masterGame.Tags, acquisitionDate);

        Assert.AreEqual(1, claimErrors.Count);
        Assert.AreEqual("That game is not eligible because the Port tag has been banned", claimErrors[0].Error);
    }
コード例 #10
0
    public void SlotInEligibleTest()
    {
        Instant acquisitionTime = InstantPattern.ExtendedIso.Parse("2022-01-31T20:49:24Z").GetValueOrThrow();
        var     acquisitionDate = acquisitionTime.ToEasternDate();

        MasterGame masterGame = CreateBasicMasterGame("Horizon Forbidden West", new LocalDate(2022, 2, 25), _tagDictionary["NG"]);

        var leagueTags = new List <LeagueTagStatus>()
        {
            new LeagueTagStatus(_tagDictionary["PRT"], TagStatus.Banned)
        };

        var slotTags = new List <LeagueTagStatus>()
        {
            new LeagueTagStatus(_tagDictionary["NGF"], TagStatus.Required)
        };

        var claimErrors = LeagueTagExtensions.GameHasValidTags(leagueTags, slotTags, masterGame, masterGame.Tags, acquisitionDate);

        Assert.AreEqual(1, claimErrors.Count);
        Assert.AreEqual("That game is not eligible because it does not have any of the following required tags: (New Gaming Franchise)", claimErrors[0].Error);
    }
コード例 #11
0
    public void EarlyAccessHasGameBeforeEarlyAccessEligible()
    {
        Instant acquisitionTime = InstantPattern.ExtendedIso.Parse("2022-01-05T20:49:24Z").GetValueOrThrow();
        var     acquisitionDate = acquisitionTime.ToEasternDate();

        MasterGame masterGame = CreateComplexMasterGame("Have a Nice Death", new LocalDate(2022, 1, 3), null,
                                                        new LocalDate(2022, 3, 6), null, null, new List <MasterGameTag>()
        {
            _tagDictionary["NG"],
            _tagDictionary["C-EA"],
        });

        var leagueTags = new List <LeagueTagStatus>()
        {
            new LeagueTagStatus(_tagDictionary["PRT"], TagStatus.Banned),
            new LeagueTagStatus(_tagDictionary["C-EA"], TagStatus.Banned),
        };

        var slotTags = new List <LeagueTagStatus>();

        var claimErrors = LeagueTagExtensions.GameHasValidTags(leagueTags, slotTags, masterGame, masterGame.Tags, acquisitionDate);

        Assert.AreEqual(0, claimErrors.Count);
    }
コード例 #12
0
    public IReadOnlyList <ClaimError> CheckGameAgainstTags(IEnumerable <LeagueTagStatus> leagueTags, IEnumerable <LeagueTagStatus> slotTags)
    {
        var tagsToUse = TagOverrides.Any() ? TagOverrides : MasterGame.Tags;

        return(LeagueTagExtensions.GameHasValidTags(leagueTags, slotTags, MasterGame, tagsToUse, DateAcquired));
    }