public CardsAddUrlAttachmentRequest(ICardId card, UrlAttachment attachment)
            : base(card, "attachments", Method.POST)
        {
            Guard.NotNull(attachment, "attachment");
            Guard.NotNullOrEmpty(attachment.Url, "attachment.Url");

            if (!string.IsNullOrEmpty(attachment.Name))
            {
                Guard.LengthBetween(attachment.Name, 0, 256, "attachment.Name");
                AddParameter("name", attachment.Name);
            }

            AddParameter("url", attachment.Url);
        }
		public CardsAddUrlAttachmentRequest(ICardId card, UrlAttachment attachment)
			: base(card, "attachments", Method.POST)
		{
			Guard.NotNull(attachment, "attachment");
			Guard.NotNullOrEmpty(attachment.Url, "attachment.Url");

			if (!string.IsNullOrEmpty(attachment.Name))
			{
				Guard.LengthBetween(attachment.Name, 0, 256, "attachment.Name");
				AddParameter("name", attachment.Name);
			}

			AddParameter("url", attachment.Url);
		}
Пример #3
0
		public void Scenario_AddAndRemoveUrlAttachment()
		{
            var card = GetWelcomeToTrelloCard();
            var expectedAttachments = card.Attachments.Count + 1;
            UrlAttachment attachment = new UrlAttachment("http://placekitten.com/200/300", "newAttachment");

            _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, cardAfterAttachment.Attachments.Last());
            cardAfterAttachment = GetWelcomeToTrelloCard();
            actualAttachments = cardAfterAttachment.Attachments.Count;
            Assert.That(actualAttachments, Is.EqualTo(expectedAttachments));
		}
Пример #4
0
		public void Scenario_AddAndRemoveUrlAttachment()
		{
            var card = GetWelcomeToTrelloCard();
            var expectedAttachments = card.Attachments.Count + 1;
            UrlAttachment attachment = new UrlAttachment("http://placekitten.com/200/300", "newAttachment");

            _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, cardAfterAttachment.Attachments.Last());
            cardAfterAttachment = GetWelcomeToTrelloCard();
            actualAttachments = cardAfterAttachment.Attachments.Count;
            Assert.That(actualAttachments, Is.EqualTo(expectedAttachments));
		}
Пример #5
0
 public void AddAttachment(ICardId card, UrlAttachment attachment)
 {
     _restClient.Request(new CardsAddUrlAttachmentRequest(card, attachment));
 }
Пример #6
0
		public void AddAttachment(ICardId card, UrlAttachment attachment)
		{
			_restClient.Request(new CardsAddUrlAttachmentRequest(card, attachment));
		}
Пример #7
0
 public Task AddAttachment(ICardId card, UrlAttachment attachment)
 {
     return _restClient.RequestAsync(new CardsAddUrlAttachmentRequest(card, attachment));
 }
Пример #8
0
 public Task AddAttachment(ICardId card, UrlAttachment attachment)
 {
     return(_restClient.RequestAsync(new CardsAddUrlAttachmentRequest(card, attachment)));
 }