Ejemplo n.º 1
0
        public MatchesBase(IInternalService internalService, IWebsiteService website, IMatchesTabService matchesTab, GameMode matchGameMode, MatchesTab currentTab)
            : base(internalService)
        {
            Website           = website;
            MatchesTabService = matchesTab;
            MatchGameMode     = matchGameMode;
            CurrentTab        = currentTab;

            ShowMatchSummaryButtonEnabled = true;

            SeasonList.AddRange(HeroesHelpers.Seasons.GetSeasonList());
            SelectedSeasonOption = SeasonList[0];

            GameTimeList           = HeroesHelpers.GameDateFilters.GameTimeList;
            SelectedGameTimeOption = FilterGameTimeOption.Any.GetFriendlyName();

            GameDateList           = HeroesHelpers.GameDateFilters.GameDateList;
            SelectedGameDateOption = FilterGameDateOption.Any.GetFriendlyName();

            MapsList.Add("Any");
            MapsList.AddRange(HeroesIcons.MapBackgrounds().GetMapsList());
            SelectedMapOption = MapsList[0];

            ReplayBuildsList.Add("Any");
            ReplayBuildsList.AddRange(HeroesIcons.GetListOfHeroesBuilds());
            SelectedBuildOption = ReplayBuildsList[0];

            HeroesList.Add("Any");
            HeroesList.AddRange(HeroesIcons.HeroBuilds().GetListOfHeroes(HeroesIcons.GetLatestHeroesBuild()));
            SelectedCharacter = HeroesList[0];

            Messenger.Default.Register <MatchesDataMessage>(this, (message) => ReceivedMatchSearchData(message));
            Messenger.Default.Register <NotificationMessage>(this, async(message) => await ReceivedMessageAsync(message));
        }
        public void HeroesTest()
        {
            HeroesIcons   heroesIcons    = new HeroesIcons(false);
            List <string> assertMessages = new List <string>();
            int           segment        = 4;

            foreach (int build in heroesIcons.GetListOfHeroesBuilds())
            {
                heroesIcons.LoadHeroesBuild(build);

                var heroes = heroesIcons.Heroes().GetListOfHeroes(build);

                foreach (var hero in heroes)
                {
                    string altName = heroesIcons.Heroes().GetAltNameFromRealHeroName(hero);

                    if (string.IsNullOrEmpty(altName))
                    {
                        Assert.Fail($"[{build}] alt name is null or emtpy for {hero}");
                    }

                    BitmapImage heroLeaderBoardPortrait = heroesIcons.Heroes().GetHeroLeaderboardPortrait(hero);
                    BitmapImage heroLoadingPortrait     = heroesIcons.Heroes().GetHeroLoadingPortrait(hero);
                    BitmapImage heroPortrait            = heroesIcons.Heroes().GetHeroPortrait(hero);

                    if (heroLeaderBoardPortrait.UriSource.Segments[segment].ToString() != $"storm_ui_ingame_hero_leaderboard_{GetUniqueHeroName(altName.ToLower())}.dds")
                    {
                        assertMessages.Add($"[{build}] Leaderboard portrait not found for {hero}");
                    }

                    if (heroLoadingPortrait.UriSource.Segments[segment].ToString() != $"storm_ui_ingame_hero_loadingscreen_{GetUniqueHeroName(altName.ToLower())}.dds")
                    {
                        assertMessages.Add($"[{build}] Loading portrait not found for {hero}");
                    }

                    if (heroPortrait.UriSource.Segments[segment].ToString() != $"storm_ui_ingame_heroselect_btn_{GetUniqueHeroName(altName.ToLower())}.dds")
                    {
                        assertMessages.Add($"[{build}] Hero portrait not found for {hero}");
                    }

                    if (heroesIcons.Heroes().GetHeroFranchise(hero) == HeroFranchise.Unknown)
                    {
                        assertMessages.Add($"[{build}] Unknown franchise for {hero}");
                    }

                    var heroRoles = heroesIcons.Heroes().GetHeroRoleList(hero);
                    if (heroRoles[0] == HeroRole.Unknown)
                    {
                        assertMessages.Add($"[{build}] Unknown hero role for {hero}");
                    }
                    if (heroRoles.Count > 1 && heroRoles[0] != HeroRole.Multiclass)
                    {
                        assertMessages.Add($"[{build}] Hero {hero} has multiple roles but first role is NOT Multiclass");
                    }
                }
            }

            AssertFailMessage(assertMessages);
        }
        public void HeroesBuildTest()
        {
            HeroesIcons   heroesIcons    = new HeroesIcons(false);
            List <string> assertMessages = new List <string>();
            int           segment        = 5;

            foreach (int build in heroesIcons.GetListOfHeroesBuilds())
            {
                heroesIcons.LoadHeroesBuild(build);

                var heroes = heroesIcons.Heroes().GetListOfHeroes(build);

                foreach (var hero in heroes)
                {
                    var talents = heroesIcons.HeroBuilds().GetAllTalentsForHero(hero);

                    if (talents == null)
                    {
                        assertMessages.Add($"[{build}] No talents found for {hero}");
                        continue;
                    }
                    if (talents[TalentTier.Level1] == null || talents[TalentTier.Level1].Count < 1)
                    {
                        assertMessages.Add($"[{build}] No Level 1 talents for {hero}");
                    }
                    if (talents[TalentTier.Level4] == null || talents[TalentTier.Level4].Count < 1)
                    {
                        assertMessages.Add($"[{build}] No Level 4 talents for {hero}");
                    }
                    if (talents[TalentTier.Level7] == null || talents[TalentTier.Level7].Count < 1)
                    {
                        assertMessages.Add($"[{build}] No Level 7 talents for {hero}");
                    }
                    if (talents[TalentTier.Level10] == null || talents[TalentTier.Level10].Count < 1)
                    {
                        assertMessages.Add($"[{build}] No Level 10 talents for {hero}");
                    }
                    if (talents[TalentTier.Level13] == null || talents[TalentTier.Level13].Count < 1)
                    {
                        assertMessages.Add($"[{build}] No Level 13 talents for {hero}");
                    }
                    if (talents[TalentTier.Level16] == null || talents[TalentTier.Level16].Count < 1)
                    {
                        assertMessages.Add($"[{build}] No Level 16 talents for {hero}");
                    }
                    if (talents[TalentTier.Level20] == null || talents[TalentTier.Level20].Count < 1)
                    {
                        assertMessages.Add($"[{build}] No Level 20 talents for {hero}");
                    }

                    // loop through each talent tier
                    foreach (var talentTier in talents)
                    {
                        if (talentTier.Key == TalentTier.Old)
                        {
                            continue;
                        }

                        // loop through each talent
                        foreach (var talent in talentTier.Value)
                        {
                            BitmapImage talentImage = heroesIcons.HeroBuilds().GetTalentIcon(talent);

                            if (talentImage.UriSource.Segments[segment].ToString() == HeroesBase.NoTalentIconPick || talentImage.UriSource.Segments[segment].ToString() == HeroesBase.NoTalentIconFound)
                            {
                                assertMessages.Add($"[{build}] Talent image not found for {talent} [{talentTier.Key.ToString()}]");
                            }

                            TalentTooltip talentTooltip = heroesIcons.HeroBuilds().GetTalentTooltips(talent);
                            if (string.IsNullOrEmpty(talentTooltip.Full))
                            {
                                assertMessages.Add($"[{build}] Full tooltip not found for {talent} [{talentTier.Key.ToString()}]");
                            }
                            else
                            {
                                string strippedText = TalentTooltipStripNonText(talentTooltip.Full);

                                if (NonValidCharsCheck(strippedText))
                                {
                                    assertMessages.Add($"[{build}] Invalid chars in FULL tooltip {talent} [{talentTier.Key.ToString()}]{Environment.NewLine}{strippedText}{Environment.NewLine}");
                                }
                            }

                            if (string.IsNullOrEmpty(talentTooltip.Short))
                            {
                                assertMessages.Add($"[{build}] Short tooltip not found for {talent} [{talentTier.Key.ToString()}]");
                            }
                            else
                            {
                                string strippedText = TalentTooltipStripNonText(talentTooltip.Short);

                                if (NonValidCharsCheck(strippedText))
                                {
                                    assertMessages.Add($"[{build}] Invalid chars in SHORT tooltip {talent} [{talentTier.Key.ToString()}]{Environment.NewLine}{strippedText}{Environment.NewLine}");
                                }
                            }

                            if (string.IsNullOrEmpty(heroesIcons.HeroBuilds().GetTrueTalentName(talent.Trim())))
                            {
                                assertMessages.Add($"[{build}] No true talent name for {talent} [{talentTier.Key.ToString()}]");
                            }
                        }
                    }
                }
            }

            AssertFailMessage(assertMessages);
        }
        public void HeroTalentsTest()
        {
            List <string> assertMessages = new List <string>();

            foreach (int build in HeroesIcons.GetListOfHeroesBuilds().ConvertAll(x => int.Parse(x)))
            {
                HeroesIcons.LoadHeroesBuild(build);

                var heroes = HeroesIcons.HeroBuilds().GetListOfHeroes(build);

                foreach (var hero in heroes)
                {
                    Hero heroInfo = HeroesIcons.HeroBuilds().GetHeroInfo(hero);

                    if (heroInfo.Talents.Values.Count < 1)
                    {
                        assertMessages.Add($"[{build}] [{hero}] No talents found");
                        continue;
                    }

                    if (heroInfo.GetTierTalents(TalentTier.Level1).Count < 1)
                    {
                        assertMessages.Add($"[{build}] [{hero}] No Level 1 talents");
                    }
                    if (heroInfo.GetTierTalents(TalentTier.Level4).Count < 1)
                    {
                        assertMessages.Add($"[{build}] [{hero}] No Level 4 talents");
                    }
                    if (heroInfo.GetTierTalents(TalentTier.Level7).Count < 1)
                    {
                        assertMessages.Add($"[{build}] [{hero}] No Level 7 talents");
                    }
                    if (heroInfo.GetTierTalents(TalentTier.Level10).Count < 1)
                    {
                        assertMessages.Add($"[{build}] [{hero}] No Level 10 talents");
                    }
                    if (heroInfo.GetTierTalents(TalentTier.Level13).Count < 1)
                    {
                        assertMessages.Add($"[{build}] [{hero}] No Level 13 talents");
                    }
                    if (heroInfo.GetTierTalents(TalentTier.Level16).Count < 1)
                    {
                        assertMessages.Add($"[{build}] [{hero}] No Level 16 talents");
                    }
                    if (heroInfo.GetTierTalents(TalentTier.Level20).Count < 1)
                    {
                        assertMessages.Add($"[{build}] [{hero}] No Level 20 talents");
                    }

                    // test a no pick (empty)
                    Talent testTalent = heroInfo.GetTalent(string.Empty);
                    if (testTalent.Name != "No pick" || testTalent.GetIcon() == null)
                    {
                        assertMessages.Add($"[{build}] [{hero}] no pick (empty) talent has incorrect name or icon steam is null");
                    }

                    // test a no pick (null)
                    testTalent = heroInfo.GetTalent(null);
                    if (testTalent.Name != "No pick" || testTalent.GetIcon() == null)
                    {
                        assertMessages.Add($"[{build}] [{hero}] not pick (null) talent has incorrect name or icon steam is null");
                    }

                    // test a not found
                    testTalent = heroInfo.GetTalent("asdf");
                    if (testTalent.Name != "asdf" || testTalent.GetIcon() == null)
                    {
                        assertMessages.Add($"[{build}] [{hero}] not found talent has incorrect name or icon steam is null");
                    }

                    foreach (var talent in heroInfo.Talents.Values)
                    {
                        if (talent.Tier == TalentTier.Old)
                        {
                            continue;
                        }

                        if (string.IsNullOrEmpty(talent.Name) && talent.Name != "No pick")
                        {
                            Assert.Fail($"[{build}] [{hero}] [{talent}] name is null or emtpy");
                        }

                        if (string.IsNullOrEmpty(talent.ReferenceName))
                        {
                            assertMessages.Add($"[{build}] [{hero}] [{talent}] talent reference name is null or emtpy");
                        }

                        if (string.IsNullOrEmpty(talent.TooltipDescriptionName))
                        {
                            assertMessages.Add($"[{build}] [{hero}] [{talent}] talent tooltip description name is null or emtpy");
                        }

                        // tooltips
                        TalentTooltip talentTooltip = talent.Tooltip;

                        // full
                        if (string.IsNullOrEmpty(talentTooltip.Full))
                        {
                            assertMessages.Add($"[{build}] [{hero}] [{talent}] Full tooltip is null or empty");
                        }
                        else
                        {
                            string strippedText = TalentTooltipStripNonText(talentTooltip.Full);

                            if (NonValidCharsCheck(strippedText))
                            {
                                assertMessages.Add($"[{build}] [{hero}] [{talent}] Invalid chars in FULL tooltip{Environment.NewLine}{strippedText}{Environment.NewLine}");
                            }
                        }

                        // short
                        if (string.IsNullOrEmpty(talentTooltip.Short))
                        {
                            assertMessages.Add($"[{build}] [{hero}] [{talent}] Short tooltip is null or empty");
                        }
                        else
                        {
                            string strippedText = TalentTooltipStripNonText(talentTooltip.Short);

                            if (NonValidCharsCheck(strippedText))
                            {
                                assertMessages.Add($"[{build}] [{hero}] [{talent}] Invalid chars in SHORT tooltip{Environment.NewLine}{strippedText}{Environment.NewLine}");
                            }
                        }

                        if (talent.GetIcon() == null)
                        {
                            assertMessages.Add($"[{build}] [{hero}] [{talent}] Icon stream is null");
                        }

                        testTalent = heroInfo.GetTalent(talent.ReferenceName);
                        if (testTalent == null || testTalent.Name == talent.ReferenceName || testTalent.Name == "No pick")
                        {
                            assertMessages.Add($"[{build}] [{hero}] [{talent}] GetTalent() failed to return correct info");
                        }
                    }
                }
            }

            AssertFailMessage(assertMessages);
        }
        public void HeroAbilitiesTest()
        {
            List <string> assertMessages = new List <string>();

            foreach (int build in HeroesIcons.GetListOfHeroesBuilds().ConvertAll(x => int.Parse(x)))
            {
                if (build < 58623)
                {
                    continue;
                }

                HeroesIcons.LoadHeroesBuild(build);

                var heroes = HeroesIcons.HeroBuilds().GetListOfHeroes(build);

                foreach (var hero in heroes)
                {
                    Hero heroInfo = HeroesIcons.HeroBuilds().GetHeroInfo(hero);

                    if (heroInfo.Abilities.Values.Count < 1)
                    {
                        assertMessages.Add($"[{build}] [{hero}] No abilities found");
                        continue;
                    }

                    if (heroInfo.GetTierAbilities(AbilityTier.Basic).Count < 1)
                    {
                        assertMessages.Add($"[{build}] [{hero}] No basic abilities");
                    }
                    if (heroInfo.GetTierAbilities(AbilityTier.Heroic).Count < 1)
                    {
                        assertMessages.Add($"[{build}] [{hero}] No heroic abilities");
                    }

                    // test a no pick (empty)
                    Ability testAbility = heroInfo.GetAbility(string.Empty);
                    if (testAbility != null)
                    {
                        assertMessages.Add($"[{build}] [{hero}] no pick (empty) ability is not null");
                    }

                    // test a no pick (null)
                    testAbility = heroInfo.GetAbility(string.Empty);
                    if (testAbility != null)
                    {
                        assertMessages.Add($"[{build}] [{hero}] no pick (null) ability is not null");
                    }

                    // test a not found
                    testAbility = heroInfo.GetAbility("asdf");
                    if (testAbility != null)
                    {
                        assertMessages.Add($"[{build}] [{hero}] not found ability is not null");
                    }

                    foreach (var ability in heroInfo.Abilities.Values)
                    {
                        if (string.IsNullOrEmpty(ability.Name))
                        {
                            Assert.Fail($"[{build}] [{hero}] [{ability}] name is null or emtpy");
                        }

                        if (string.IsNullOrEmpty(ability.ReferenceName))
                        {
                            assertMessages.Add($"[{build}] [{hero}] [{ability}] ability reference name is null or emtpy");
                        }

                        if (string.IsNullOrEmpty(ability.TooltipDescriptionName) && ability.Name != "[None]")
                        {
                            assertMessages.Add($"[{build}] [{hero}] [{ability}] talent tooltip description name is null or emtpy");
                        }

                        // tooltips
                        TalentTooltip talentTooltip = ability.Tooltip;

                        // full
                        if (string.IsNullOrEmpty(talentTooltip.Full) && ability.Name != "[None]")
                        {
                            assertMessages.Add($"[{build}] [{hero}] [{ability}] Full tooltip is null or empty");
                        }
                        else
                        {
                            string strippedText = TalentTooltipStripNonText(talentTooltip.Full);

                            if (NonValidCharsCheck(strippedText))
                            {
                                assertMessages.Add($"[{build}] [{hero}] [{ability}] Invalid chars in FULL tooltip{Environment.NewLine}{strippedText}{Environment.NewLine}");
                            }
                        }

                        // short
                        if (string.IsNullOrEmpty(talentTooltip.Short) && ability.Name != "[None]")
                        {
                            assertMessages.Add($"[{build}] [{hero}] [{ability}] Short tooltip is null or empty");
                        }
                        else
                        {
                            string strippedText = TalentTooltipStripNonText(talentTooltip.Short);

                            if (NonValidCharsCheck(strippedText))
                            {
                                assertMessages.Add($"[{build}] [{hero}] [{ability}] Invalid chars in SHORT tooltip{Environment.NewLine}{strippedText}{Environment.NewLine}");
                            }
                        }

                        if (ability.GetIcon() == null && ability.Name != "[None]")
                        {
                            assertMessages.Add($"[{build}] [{hero}] [{ability}] Icon stream is null");
                        }

                        testAbility = heroInfo.GetAbility(ability.ReferenceName);
                        if (testAbility == null || testAbility.Name == ability.ReferenceName)
                        {
                            assertMessages.Add($"[{build}] [{hero}] [{ability}] GetAbility() failed to return correct info");
                        }
                    }
                }
            }

            AssertFailMessage(assertMessages);
        }
        public void HeroesTests()
        {
            List <string> assertMessages = new List <string>();

            foreach (int build in HeroesIcons.GetListOfHeroesBuilds().ConvertAll(x => int.Parse(x)))
            {
                HeroesIcons.LoadHeroesBuild(build);

                var heroes = HeroesIcons.HeroBuilds().GetListOfHeroes(build);

                foreach (var hero in heroes)
                {
                    Hero heroInfo = HeroesIcons.HeroBuilds().GetHeroInfo(hero);

                    if (string.IsNullOrEmpty(heroInfo.Name))
                    {
                        Assert.Fail($"[{build}] [{hero}] name is null or emtpy");
                    }

                    if (string.IsNullOrEmpty(heroInfo.ShortName))
                    {
                        assertMessages.Add($"[{build}] [{hero}] short name is null or emtpy");
                    }

                    if (build >= HeroesBase.HeroUnitsAddedBuild && string.IsNullOrEmpty(heroInfo.UnitName))
                    {
                        assertMessages.Add($"[{build}] [{hero}] unit name is null or emtpy");
                    }

                    if (string.IsNullOrEmpty(heroInfo.AttributeId))
                    {
                        assertMessages.Add($"[{build}] [{hero}] attributeId is null or emtpy");
                    }

                    if (build >= HeroesBase.DescriptionsAddedBuild && string.IsNullOrEmpty(heroInfo.Description))
                    {
                        assertMessages.Add($"[{build}] [{hero}] description is null or emtpy");
                    }

                    if (heroInfo.Type == HeroType.Unknown)
                    {
                        assertMessages.Add($"[{build}] [{hero}] type is unknown");
                    }

                    if (heroInfo.Difficulty == HeroDifficulty.Unknown)
                    {
                        assertMessages.Add($"[{build}] [{hero}] difficulty is unknown");
                    }

                    if (heroInfo.BuildAvailable == 0)
                    {
                        assertMessages.Add($"[{build}] [{hero}] build available is 0");
                    }

                    if (heroInfo.Franchise == HeroFranchise.Unknown)
                    {
                        assertMessages.Add($"[{build}] Unknown franchise for {hero}");
                    }

                    var heroRoles = heroInfo.Roles;
                    if (heroRoles[0] == HeroRole.Unknown)
                    {
                        assertMessages.Add($"[{build}] Unknown hero role for {hero}");
                    }
                    if (heroRoles.Count > 1 && heroRoles[0] != HeroRole.Multiclass)
                    {
                        assertMessages.Add($"[{build}] Hero {hero} has multiple roles but first role is NOT Multiclass");
                    }

                    if (!heroInfo.HeroPortrait.EndsWith($"{HeroPortraitPrefix}{GetUniqueHeroName(heroInfo.ShortName.ToLowerInvariant())}.png"))
                    {
                        assertMessages.Add($"[{build}] Hero portrait string not found for {hero}");
                    }

                    if (!heroInfo.LoadingPortrait.EndsWith($"{LoadingPortraitPrefix}{GetUniqueHeroName(heroInfo.ShortName.ToLowerInvariant())}.png"))
                    {
                        assertMessages.Add($"[{build}] Loading portrait string not found for {hero}");
                    }

                    if (!heroInfo.LeaderboardPortrait.EndsWith($"{LeaderboardPortraitPrefix}{GetUniqueHeroName(heroInfo.ShortName.ToLowerInvariant())}.png"))
                    {
                        assertMessages.Add($"[{build}] Leaderboard portrait string not found for {hero}");
                    }

                    if (heroInfo.GetHeroPortrait() == null)
                    {
                        assertMessages.Add($"[{build}] Hero portrait stream not found for {hero}");
                    }

                    if (heroInfo.GetLoadingPortrait() == null)
                    {
                        assertMessages.Add($"[{build}] Loading portrait stream not found for {hero}");
                    }

                    if (heroInfo.GetLeaderboardPortrait() == null)
                    {
                        assertMessages.Add($"[{build}] Leaderboard portrait stream not found for {hero}");
                    }
                }
            }

            AssertFailMessage(assertMessages);
        }