// [TestMethod]
        // [TestCategory("Attachment")]
        public void CreateAttachment()
        {
            var name = "TournamentTest" + Utilities.RandomName();

            var tournamentParameter = new TournamentCreateParameters { AcceptAttachments = true };
            this.tournament = this.target.TournamentCreate(name, TournamentType.DoubleElimination, name, tournamentParameter);
            Assert.IsTrue(this.tournament.AcceptAttachments);
            Debug.WriteLine("Created: ({0}){1} Url:{2} subdomain:{3}", this.tournament.Id, this.tournament.Name, this.tournament.Url, this.tournament.Subdomain);

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

            var matches = this.target.MatchIndex(this.tournament);

            var match1 = matches.First();
            var parameters = new AttachmentCreateParameters
                {
                    Description = "This is just another description",
                    Asset = "The quick brown fox jumps over the lazy dog."
                };
            Debug.WriteLine("Attachment Create request");
            var attachment = this.target.AttachmentCreate(this.tournament, match1.Id, parameters);
            Assert.IsNotNull(attachment);
        }
Esempio n. 2
0
        public Attachment AttachmentCreate(Tournament tournament, int matchId, AttachmentCreateParameters parameters = null)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException("parameters");
            }

            Dictionary<string, dynamic> param = parameters.ToDictionary();

            string url = string.Format("tournaments/{0}/matches/{1}/attachments", this.TournamentIdentifier(tournament), matchId);
            var json = this.MakeJsonRequest(url, WebRequestMethods.Http.Post, param);

            return Deserializer.Attachment(json);
        }