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 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)); }
public void AddAttachment(ICardId card, UrlAttachment attachment) { _restClient.Request(new CardsAddUrlAttachmentRequest(card, attachment)); }
public Task AddAttachment(ICardId card, UrlAttachment attachment) { return _restClient.RequestAsync(new CardsAddUrlAttachmentRequest(card, attachment)); }
public Task AddAttachment(ICardId card, UrlAttachment attachment) { return(_restClient.RequestAsync(new CardsAddUrlAttachmentRequest(card, attachment))); }