public CardsAddAttachmentRequest(ICardId card, NewAttachment attachment)
			: base(card, "attachments", Method.POST)
		{
            if (!string.IsNullOrEmpty(attachment.Name))
    			AddParameter("name", attachment.Name);
            if (!string.IsNullOrEmpty(attachment.Url))
    			AddParameter("url", attachment.Url);
		}
Пример #2
0
		public void Scenario_AddAndRemoveAttachment()
		{
            var card = GetWelcomeToTrelloCard();
            var expectedAttachments = card.Attachments.Count + 1;
            NewAttachment attachment = new NewAttachment("newAttachment", "http://placekitten.com/200/300");

            _trelloReadWrite.Cards.AddAttachment(card, attachment);

            var cardAfterAttachment = GetWelcomeToTrelloCard();
            var actualAttachments = cardAfterAttachment.Attachments.Count;

            Assert.That(actualAttachments, Is.EqualTo(expectedAttachments));
		    Assert.IsNotNullOrEmpty(cardAfterAttachment.Attachments.Last().Url);
            //Not testig mimeType because it always seems to come back null

		    expectedAttachments = card.Attachments.Count;
		    _trelloReadWrite.Cards.RemoveAttachment(card, card.Attachments.Last());
            cardAfterAttachment = GetWelcomeToTrelloCard();
            actualAttachments = cardAfterAttachment.Attachments.Count;
            Assert.That(actualAttachments, Is.EqualTo(expectedAttachments));
		}
Пример #3
0
		public Task AddAttachment(ICardId card, NewAttachment attachment)
		{
			return _restClient.RequestAsync(new CardsAddAttachmentRequest(card, attachment));
		}