Exemple #1
0
        public void GetGuildDetailsByIdTest(string guild_id, bool ignoreCache)
        {
            var actual   = GwApi.GetGuildDetailsById(guild_id, ignoreCache);
            var expected = TestData.GuildDetailsExpected.Single(g => g.GuildId == g.GuildId);

            VerifyGuildDetailsEntry(expected, actual);
        }
        public void MatchesExample()
        {
            GwApi.Network = new NetworkHandler();
            // Well need this so lets get it now
            var worlds     = GwApi.GetWorldNames();
            var objectives = GwApi.GetObjectiveNames();

            // Lets get a list of matches
            var matches = GwApi.GetMatches();
            var match   = matches.Values.FirstOrDefault();
            // ok lets check out the details of one of these matches
            var           details = GwApi.GetMatchDetails(match.Id);
            StringBuilder sb      = new StringBuilder("Match Info\n");

            sb.AppendFormat("Worlds:\n");
            sb.AppendFormat("{0} vs. {1} vs. {2}\n", worlds[match.RedWorldId].Name, worlds[match.BlueWorldId].Name, worlds[match.GreenWorldId].Name);
            sb.AppendFormat("Scores: Red - {0}; Blue - {1}; Green - {2}\n", details.Scores[0], details.Scores[1], details.Scores[2]);
            sb.AppendFormat("Start Time: {0}\n", match.StartTime);
            sb.AppendFormat("End Time: {0}\n", match.EndTime);
            sb.AppendFormat("Maps:\n");
            foreach (var map in details.Maps)
            {
                sb.AppendFormat("  {0}\n", map.Type);
                sb.AppendFormat("  Scores: Red - {0}; Blue - {1}; Green - {2}\n", map.Scores[0], map.Scores[1], map.Scores[2]);
                foreach (var objective in map.Objectives)
                {
                    sb.AppendFormat("  {0} - {1}\n", objectives[objective.Id].Name, objective.Owner);
                    if (objective.OwnerGuildId != Guid.Empty)
                    {
                        sb.AppendFormat("    Guild: {0}\n", GwApi.GetGuildDetailsById(objective.OwnerGuildId).GuildName);
                    }
                }
            }

            Console.WriteLine(sb.ToString());
        }