Пример #1
0
        /// <summary>
        /// Fetch a specific participant.
        /// </summary>
        /// <param name="tournament"></param>
        /// <param name="participantId"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public Participant ParticipantShow(Tournament tournament, int participantId, ParticipantShowParameters parameters = null)
        {
            string url = string.Format("tournaments/{0}/participants/{1}", this.TournamentIdentifier(tournament), participantId);
            var param = new Dictionary<string, dynamic>();
            if (parameters != null)
            {
                param = parameters.ToDictionary();
            }

            var json = this.MakeJsonRequest(url, WebRequestMethods.Http.Get, param);
            return Deserializer.Participant(json);
        }
        public void ShowOptionalParameters()
        {
            var tournamentName = Utilities.RandomName();
            this.tournament = this.target.TournamentCreate(tournamentName, TournamentType.SingleElimination, tournamentName);

            var participant1 = this.target.ParticipantCreate(this.tournament, new ParticipantCreateParameters { Name = Utilities.RandomName() });
            this.target.ParticipantCreate(this.tournament, new ParticipantCreateParameters { Name = Utilities.RandomName() });

            this.target.TournamentStart(this.tournament);

            var parameters = new ParticipantShowParameters { IncludeMatches = true };
            var participant1Show = this.target.ParticipantShow(this.tournament, participant1.Id, parameters);

            Assert.IsNotNull(participant1Show.Matches);
            Assert.AreEqual(1, participant1Show.Matches.Count);
            Assert.IsNotNull(participant1Show.Matches.Find(p => p.Match.Player1Id == participant1.Id));
        }