public void HeroUnitNameTest() { Assert.IsTrue(HeroesIcons.HeroBuilds().GetRealHeroNameFromHeroUnitName("HeroAbathur") == "Abathur"); Assert.IsTrue(HeroesIcons.HeroBuilds().GetRealHeroNameFromHeroUnitName(string.Empty) == string.Empty); Assert.IsTrue(HeroesIcons.HeroBuilds().GetRealHeroNameFromHeroUnitName(null) == string.Empty); Assert.IsTrue(HeroesIcons.HeroBuilds().GetRealHeroNameFromHeroUnitName("asdf") == null); }
public void HeroExistsTest() { Assert.IsTrue(HeroesIcons.HeroBuilds().HeroExists("Anubarak")); Assert.IsTrue(HeroesIcons.HeroBuilds().HeroExists("Anub'arak")); Assert.IsFalse(HeroesIcons.HeroBuilds().HeroExists("asdf")); }
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 GetHeroInfoTest() { Hero heroInfo = HeroesIcons.HeroBuilds().GetHeroInfo(string.Empty); Assert.IsTrue(heroInfo.Name == string.Empty); Assert.IsTrue(heroInfo.Franchise == HeroFranchise.Unknown); Assert.IsTrue(heroInfo.HeroPortrait.Contains(HeroesBase.NoPortraitFound)); Assert.IsTrue(heroInfo.LeaderboardPortrait.Contains(HeroesBase.NoLeaderboardFound)); Assert.IsTrue(heroInfo.LoadingPortrait.Contains(HeroesBase.NoLoadingScreenFound)); Assert.IsTrue(heroInfo.GetHeroPortrait() != null); Assert.IsTrue(heroInfo.GetLeaderboardPortrait() != null); Assert.IsTrue(heroInfo.GetLoadingPortrait() != null); heroInfo = HeroesIcons.HeroBuilds().GetHeroInfo(null); Assert.IsTrue(heroInfo.Name == null); Assert.IsTrue(heroInfo.Franchise == HeroFranchise.Unknown); Assert.IsTrue(heroInfo.HeroPortrait.Contains(HeroesBase.NoPortraitPick)); Assert.IsTrue(heroInfo.LeaderboardPortrait.Contains(HeroesBase.NoLeaderboardPick)); Assert.IsTrue(heroInfo.LoadingPortrait.Contains(HeroesBase.NoLoadingScreenPick)); Assert.IsTrue(heroInfo.GetHeroPortrait() != null); Assert.IsTrue(heroInfo.GetLeaderboardPortrait() != null); Assert.IsTrue(heroInfo.GetLoadingPortrait() != null); heroInfo = HeroesIcons.HeroBuilds().GetHeroInfo("Anubarak"); Assert.IsTrue(heroInfo.Name == "Anub'arak"); Assert.IsTrue(heroInfo.Franchise == HeroFranchise.Warcraft); }
public void GetRealHeroNameFromAttributeIdTest() { Assert.IsTrue(HeroesIcons.HeroBuilds().GetRealHeroNameFromAttributeId("Abat") == "Abathur"); Assert.IsTrue(HeroesIcons.HeroBuilds().GetRealHeroNameFromAttributeId("Anub") == "Anub'arak"); Assert.IsTrue(HeroesIcons.HeroBuilds().GetRealHeroNameFromAttributeId(string.Empty) == string.Empty); Assert.IsTrue(HeroesIcons.HeroBuilds().GetRealHeroNameFromAttributeId(null) == string.Empty); Assert.IsTrue(HeroesIcons.HeroBuilds().GetRealHeroNameFromAttributeId("asdf") == null); }
public void GetRealHeroNameFromShortNameTest() { Assert.IsTrue(HeroesIcons.HeroBuilds().GetRealHeroNameFromShortName("Anubarak") == "Anub'arak"); Assert.IsTrue(HeroesIcons.HeroBuilds().GetRealHeroNameFromShortName("Abathur") == "Abathur"); Assert.IsTrue(HeroesIcons.HeroBuilds().GetRealHeroNameFromShortName(string.Empty) == string.Empty); Assert.IsTrue(HeroesIcons.HeroBuilds().GetRealHeroNameFromShortName(null) == string.Empty); Assert.IsTrue(HeroesIcons.HeroBuilds().GetRealHeroNameFromShortName("asdf") == null); }
private bool IsHealingStatCharacter(string realHeroName) { if (HeroesIcons.HeroBuilds().GetHeroInfo(realHeroName).Roles.FirstOrDefault() == HeroRole.Support || HeroesIcons.IsNonSupportHeroWithHealingStat(realHeroName)) { return(true); } else { return(false); } }
public void SetPlayerInfo(bool isAutoSelect, Dictionary <int, PartyIconColor> playerPartyIcons, Dictionary <long, string> matchAwardDictionary) { var playerInfo = Database.ReplaysDb().HotsPlayer.ReadRecordFromPlayerId(Player.PlayerId); Hero hero = HeroesIcons.HeroBuilds().GetHeroInfo(Player.Character); LeaderboardPortrait = Player.Character != "None" ? hero.GetLeaderboardPortrait() : null; Silenced = Player.IsSilenced; CharacterName = hero.Name; PlayerName = Database.SettingsDb().UserSettings.IsBattleTagHidden ? HeroesHelpers.BattleTags.GetNameFromBattleTagName(playerInfo.BattleTagName) : playerInfo.BattleTagName; PlayerBattleTagName = playerInfo.BattleTagName; PlayerRegion = (Region)playerInfo.BattleNetRegionId; IsUserPlayer = (playerInfo.PlayerId == UserProfile.PlayerId && playerInfo.BattleNetRegionId == UserProfile.RegionId) ? true : false; if (Player.Team == 4) { CharacterLevel = "Observer"; } else { CharacterLevel = isAutoSelect ? "Auto Select" : Player.CharacterLevel.ToString(); } PlayerTag = new PlayerTag { PlayerName = PlayerName, AccountLevel = Player.AccountLevel > 0 ? Player.AccountLevel.ToString() : "N/A", TotalSeen = playerInfo.Seen, LastSeenBefore = playerInfo.LastSeenBefore.HasValue ? playerInfo.LastSeenBefore.Value.ToString() : "Never", FormerPlayerNames = Database.ReplaysDb().RenamedPlayer.ReadPlayersFromPlayerId(playerInfo.PlayerId), Notes = playerInfo.Notes ?? string.Empty, }; HeroDescription = new HeroDescription { HeroName = hero.Name, Description = hero.Description, Franchise = HeroesIcons.GetFranchiseIcon(hero.Franchise), Type = hero.Type, Difficulty = hero.Difficulty, Roles = hero.Roles, }; if (playerPartyIcons.ContainsKey(Player.PlayerNumber)) { SetPartyIcon(playerPartyIcons[Player.PlayerNumber]); } if (matchAwardDictionary.ContainsKey(Player.PlayerId)) { SetMVPAward(matchAwardDictionary[Player.PlayerId]); } }
public void SetTalents(ReplayMatchPlayerTalent playerTalentList) { HeroesIcons.HeroBuilds().GetHeroInfo(playerTalentList.Character).GetTalent(playerTalentList.TalentName1); var talent1 = HeroesIcons.HeroBuilds().GetHeroInfo(playerTalentList.Character).GetTalent(playerTalentList.TalentName1); var talent4 = HeroesIcons.HeroBuilds().GetHeroInfo(playerTalentList.Character).GetTalent(playerTalentList.TalentName4); var talent7 = HeroesIcons.HeroBuilds().GetHeroInfo(playerTalentList.Character).GetTalent(playerTalentList.TalentName7); var talent10 = HeroesIcons.HeroBuilds().GetHeroInfo(playerTalentList.Character).GetTalent(playerTalentList.TalentName10); var talent13 = HeroesIcons.HeroBuilds().GetHeroInfo(playerTalentList.Character).GetTalent(playerTalentList.TalentName13); var talent16 = HeroesIcons.HeroBuilds().GetHeroInfo(playerTalentList.Character).GetTalent(playerTalentList.TalentName16); var talent20 = HeroesIcons.HeroBuilds().GetHeroInfo(playerTalentList.Character).GetTalent(playerTalentList.TalentName20); Talents.Add(talent1.GetIcon()); Talents.Add(talent4.GetIcon()); Talents.Add(talent7.GetIcon()); Talents.Add(talent10.GetIcon()); Talents.Add(talent13.GetIcon()); Talents.Add(talent16.GetIcon()); Talents.Add(talent20.GetIcon()); TalentNames.Add(talent1.Name); TalentNames.Add(talent4.Name); TalentNames.Add(talent7.Name); TalentNames.Add(talent10.Name); TalentNames.Add(talent13.Name); TalentNames.Add(talent16.Name); TalentNames.Add(talent20.Name); TalentShortTooltips.Add($"<c val=\"FFFFFF\">{talent1.Name}:</c> {talent1.Tooltip.Short}"); TalentShortTooltips.Add($"<c val=\"FFFFFF\">{talent4.Name}:</c> {talent1.Tooltip.Short}"); TalentShortTooltips.Add($"<c val=\"FFFFFF\">{talent7.Name}:</c> {talent1.Tooltip.Short}"); TalentShortTooltips.Add($"<c val=\"FFFFFF\">{talent10.Name}:</c> {talent1.Tooltip.Short}"); TalentShortTooltips.Add($"<c val=\"FFFFFF\">{talent13.Name}:</c> {talent1.Tooltip.Short}"); TalentShortTooltips.Add($"<c val=\"FFFFFF\">{talent16.Name}:</c> {talent1.Tooltip.Short}"); TalentShortTooltips.Add($"<c val=\"FFFFFF\">{talent20.Name}:</c> {talent1.Tooltip.Short}"); TalentFullTooltips.Add(talent1.Tooltip.Full); TalentFullTooltips.Add(talent4.Tooltip.Full); TalentFullTooltips.Add(talent7.Tooltip.Full); TalentFullTooltips.Add(talent10.Tooltip.Full); TalentFullTooltips.Add(talent13.Tooltip.Full); TalentFullTooltips.Add(talent16.Tooltip.Full); TalentFullTooltips.Add(talent20.Tooltip.Full); TalentSubInfo.Add(talent1.Tooltip.GetTalentSubInfo()); TalentSubInfo.Add(talent4.Tooltip.GetTalentSubInfo()); TalentSubInfo.Add(talent7.Tooltip.GetTalentSubInfo()); TalentSubInfo.Add(talent10.Tooltip.GetTalentSubInfo()); TalentSubInfo.Add(talent13.Tooltip.GetTalentSubInfo()); TalentSubInfo.Add(talent16.Tooltip.GetTalentSubInfo()); TalentSubInfo.Add(talent20.Tooltip.GetTalentSubInfo()); }
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.Battlegrounds().Battlegrounds(true).Select(x => x.Name).ToList()); SelectedMapOption = MapsList[0]; ReplayBuildsList.Add("Any"); ReplayBuildsList.AddRange(HeroesIcons.HeroBuilds().Builds); SelectedBuildOption = ReplayBuildsList[0]; HeroesList.Add("Any"); HeroesList.AddRange(HeroesIcons.HeroesData().HeroNames().OrderBy(x => x).ToList()); SelectedCharacter = HeroesList[0]; PartyCountList.Add("Any"); PartyCountList.AddRange(HeroesHelpers.Parties.GetPartyList()); SelectedParty = PartyCountList[0]; SelectedAccountLevel = 0; Messenger.Default.Register <MatchesDataMessage>(this, (message) => ReceivedMatchSearchData(message)); Messenger.Default.Register <NotificationMessage>(this, async(message) => await ReceivedMessageAsync(message)); }
public StatsHeroesViewModel(IInternalService internalService, ILoadingOverlayWindowService loadingOverlayWindow) : base(internalService) { HeroesIcons.LoadLatestHeroesBuild(); LoadingOverlayWindow = loadingOverlayWindow; IsTotalsAveragesChecked = true; IsTalentsChecked = true; IsAwardsChecked = true; SeasonList.Add(InitialSeasonListOption); SeasonList.AddRange(HeroesHelpers.Seasons.GetSeasonList()); SelectedSeason = SeasonList[0]; HeroesList.Add(InitialHeroListOption); HeroesList.AddRange(HeroesIcons.HeroBuilds().GetListOfHeroes(HeroesIcons.GetLatestHeroesBuild())); SelectedHero = HeroesList[0]; GameModeList.AddRange(HeroesHelpers.GameModes.GetAllGameModesList()); MapList.AddRange(HeroesIcons.MapBackgrounds().GetMapsList()); StatsHeroesDataViewModel = new StatsHeroesDataViewModel(internalService, MapList); }
public void GetListOfHeroesTest() { Assert.IsTrue(HeroesIcons.HeroBuilds().GetListOfHeroes(57797).Count > 1); Assert.IsTrue(HeroesIcons.HeroBuilds().GetListOfHeroes(0).Count == 0); }
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 GetPatchNotesFromBuildTest() { Assert.IsNotNull(HeroesIcons.HeroBuilds().GetPatchNotes(57797)); Assert.IsNull(HeroesIcons.HeroBuilds().GetPatchNotes(0)); }
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); }
public void SetTalents(ReplayMatchPlayerTalent playerTalentList) { List <BitmapImage> talents = new List <BitmapImage>(); List <string> talentNames = new List <string>(); List <string> talentShortTooltips = new List <string>(); List <string> talentFullTooltips = new List <string>(); var talentIcon1 = HeroesIcons.HeroBuilds().GetTalentIcon(playerTalentList.TalentName1); talentIcon1.Freeze(); var talentIcon4 = HeroesIcons.HeroBuilds().GetTalentIcon(playerTalentList.TalentName4); talentIcon4.Freeze(); var talentIcon7 = HeroesIcons.HeroBuilds().GetTalentIcon(playerTalentList.TalentName7); talentIcon7.Freeze(); var talentIcon10 = HeroesIcons.HeroBuilds().GetTalentIcon(playerTalentList.TalentName10); talentIcon10.Freeze(); var talentIcon13 = HeroesIcons.HeroBuilds().GetTalentIcon(playerTalentList.TalentName13); talentIcon13.Freeze(); var talentIcon16 = HeroesIcons.HeroBuilds().GetTalentIcon(playerTalentList.TalentName16); talentIcon16.Freeze(); var talentIcon20 = HeroesIcons.HeroBuilds().GetTalentIcon(playerTalentList.TalentName20); talentIcon20.Freeze(); talents.Add(talentIcon1); talents.Add(talentIcon4); talents.Add(talentIcon7); talents.Add(talentIcon10); talents.Add(talentIcon13); talents.Add(talentIcon16); talents.Add(talentIcon20); talentNames.Add(HeroesIcons.HeroBuilds().GetTrueTalentName(playerTalentList.TalentName1)); talentNames.Add(HeroesIcons.HeroBuilds().GetTrueTalentName(playerTalentList.TalentName4)); talentNames.Add(HeroesIcons.HeroBuilds().GetTrueTalentName(playerTalentList.TalentName7)); talentNames.Add(HeroesIcons.HeroBuilds().GetTrueTalentName(playerTalentList.TalentName10)); talentNames.Add(HeroesIcons.HeroBuilds().GetTrueTalentName(playerTalentList.TalentName13)); talentNames.Add(HeroesIcons.HeroBuilds().GetTrueTalentName(playerTalentList.TalentName16)); talentNames.Add(HeroesIcons.HeroBuilds().GetTrueTalentName(playerTalentList.TalentName20)); var talent1 = HeroesIcons.HeroBuilds().GetTalentTooltips(playerTalentList.TalentName1); var talent4 = HeroesIcons.HeroBuilds().GetTalentTooltips(playerTalentList.TalentName4); var talent7 = HeroesIcons.HeroBuilds().GetTalentTooltips(playerTalentList.TalentName7); var talent10 = HeroesIcons.HeroBuilds().GetTalentTooltips(playerTalentList.TalentName10); var talent13 = HeroesIcons.HeroBuilds().GetTalentTooltips(playerTalentList.TalentName13); var talent16 = HeroesIcons.HeroBuilds().GetTalentTooltips(playerTalentList.TalentName16); var talent20 = HeroesIcons.HeroBuilds().GetTalentTooltips(playerTalentList.TalentName20); talentShortTooltips.Add($"<c val=\"FFFFFF\">{talentNames[0]}:</c> {talent1.Short}"); talentShortTooltips.Add($"<c val=\"FFFFFF\">{talentNames[1]}:</c> {talent4.Short}"); talentShortTooltips.Add($"<c val=\"FFFFFF\">{talentNames[2]}:</c> {talent7.Short}"); talentShortTooltips.Add($"<c val=\"FFFFFF\">{talentNames[3]}:</c> {talent10.Short}"); talentShortTooltips.Add($"<c val=\"FFFFFF\">{talentNames[4]}:</c> {talent13.Short}"); talentShortTooltips.Add($"<c val=\"FFFFFF\">{talentNames[5]}:</c> {talent16.Short}"); talentShortTooltips.Add($"<c val=\"FFFFFF\">{talentNames[6]}:</c> {talent20.Short}"); talentFullTooltips.Add(talent1.Full); talentFullTooltips.Add(talent4.Full); talentFullTooltips.Add(talent7.Full); talentFullTooltips.Add(talent10.Full); talentFullTooltips.Add(talent13.Full); talentFullTooltips.Add(talent16.Full); talentFullTooltips.Add(talent20.Full); Talents = talents; TalentNames = talentNames; TalentShortTooltips = talentShortTooltips; TalentFullTooltips = talentFullTooltips; }
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 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); }