public void GetImageURL(long imageID, string uri)
        {
            var imageURL = accessor.GetImageURL(imageID);

            Assert.AreEqual(uri, imageURL.OriginalString);
        }
Esempio n. 2
0
        private Team convertJsonTeamToTeam(JsonTeam team, JsonTeamProfile teamProfile, IEnumerable <Player> players, IEnumerable <ProPlayer> accounts)
        {
            //This occurs when the game is in the drafting stage & no heroes have been picked
            if (team == null)
            {
                if (teamProfile != null)
                {
                    return(new Team
                    {
                        Players = players,
                        OfficialTeam = new OfficialTeam
                        {
                            ID = teamProfile.ID,
                            Name = teamProfile.Name,
                            LogoURL = accessor.GetImageURL(teamProfile.LogoID),
                            CaptainID = teamProfile.CaptainID,
                            Players = accounts
                        }
                    });
                }
                else
                {
                    //This happens when a team has an official ID but for some reason doesn't have a Team Profile
                    return(new Team
                    {
                        Players = players,
                        OfficialTeam = new OfficialTeam
                        {
                            ID = 0,
                            Name = "Unofficial Team",
                            LogoURL = accessor.GetImageURL(0),
                            CaptainID = 0,
                            Players = accounts
                        }
                    });
                }
            }
            if (team.HeroPicks == null)
            {
                team.HeroPicks = new int[0];
            }
            if (team.HeroBans == null)
            {
                team.HeroBans = new int[0];
            }

            return(new Team
            {
                Kills = team.Score,
                //TODO: Convert to actually useful form of barracks state
                BarracksState = team.BarracksState,
                //TODO: Convert to actually useful form of tower state
                TowerState = team.TowerState,
                Picks = team.HeroPicks.Select(t => heroes[t]).ToArray(),
                Bans = team.HeroBans.Select(t => heroes[t]).ToArray(),
                Players = players,
                OfficialTeam = new OfficialTeam
                {
                    ID = teamProfile.ID,
                    Name = teamProfile.Name,
                    LogoURL = accessor.GetImageURL(teamProfile.LogoID),
                    CaptainID = teamProfile.CaptainID,
                    Players = accounts
                }
            });
        }