public async Task Issue46_DueComplete() { ICard card = null; var name = "due complete test"; var description = "this is a description"; var position = Position.Top; var dueDate = new DateTime(2014, 1, 1); try { TrelloAuthorization.Default.AppKey = TrelloIds.AppKey; var list = _factory.List(TrelloIds.ListId); card = await list.Cards.Add(name, description, position, dueDate); Assert.AreEqual(false, card.IsComplete); card.IsComplete = true; await TrelloProcessor.Flush(); var recard = _factory.Card(card.Id); await recard.Refresh(); Assert.AreEqual(true, recard.IsComplete); await TrelloProcessor.Flush(); } finally { card?.Delete(); } }
public async Task Issue32_CancelPendingRequests() { var serializer = new ManateeSerializer(); TrelloConfiguration.Serializer = serializer; TrelloConfiguration.Deserializer = serializer; TrelloConfiguration.JsonFactory = new ManateeFactory(); TrelloConfiguration.RestClientProvider = new WebApiClientProvider(); TrelloAuthorization.Default.AppKey = TrelloIds.AppKey; TrelloAuthorization.Default.UserToken = TrelloIds.UserToken; TrelloProcessor.ConcurrentCallCount = 1; var cards = new List <Card> { new Card("KHKms82H"), new Card("AgTd8qhF"), new Card("R1Kc5KHd"), new Card("vlgbqJES"), new Card("uVD9TAIK"), new Card("prSr36Ny"), new Card("hBoTLb9V"), }; var nameTasks = cards.Select(c => Task.Run(() => c.Name)).ToList(); TrelloProcessor.CancelPendingRequests(); var names = await Task.WhenAll(nameTasks); Assert.AreEqual(0, names.Count(n => n != null)); }
public void Issue59_EditComments() { Card card = null; var name = "edit comment test"; try { var serializer = new ManateeSerializer(); TrelloConfiguration.Serializer = serializer; TrelloConfiguration.Deserializer = serializer; TrelloConfiguration.JsonFactory = new ManateeFactory(); TrelloConfiguration.RestClientProvider = new WebApiClientProvider(); TrelloAuthorization.Default.AppKey = TrelloIds.AppKey; TrelloAuthorization.Default.UserToken = TrelloIds.UserToken; TrelloConfiguration.ExpiryTime = TimeSpan.FromSeconds(1); var list = new List(TrelloIds.ListId); card = list.Cards.Add(name); var comment = card.Comments.Add("This is a comment"); comment.Data.Text = "This comment was changed."; Thread.Sleep(5); TrelloProcessor.Flush(); } finally { card?.Delete(); } }
public async Task CardProcessesWebhook() { List <string> properties = null; try { var cardData = "{\"id\":\"5a72b7ab3711a44643c5ed49\",\"badges\":{\"votes\":0,\"attachmentsByType\":{\"trello\":{\"board\":0,\"card\":0}},\"viewingMemberVoted\":false,\"subscribed\":false,\"fogbugz\":\"\",\"checkItems\":2,\"checkItemsChecked\":1,\"comments\":1,\"attachments\":1,\"description\":true,\"due\":null,\"dueComplete\":false},\"checkItemStates\":[{\"idCheckItem\":\"5aa7a08854b35d7eb0c497db\",\"state\":\"complete\"}],\"closed\":false,\"dueComplete\":false,\"dateLastActivity\":\"2018-05-19T00:06:58.640Z\",\"desc\":\"the original description\",\"descData\":{\"emoji\":{}},\"due\":null,\"email\":null,\"idBoard\":\"51478f6469fd3d9341001dae\",\"idChecklists\":[\"5aa7a081fa623ac86b7856e1\"],\"idList\":\"51478f6469fd3d9341001daf\",\"idMembers\":[\"50b693ad6f122b4310000a3c\"],\"idMembersVoted\":[],\"idShort\":1344,\"idAttachmentCover\":\"5a72b801baac36a68ea5c10b\",\"labels\":[{\"id\":\"5475f8a629b56a928f0b20fa\",\"idBoard\":\"51478f6469fd3d9341001dae\",\"name\":\"Colorless Label\",\"color\":null},{\"id\":\"545b37fa74d650d567d4c15a\",\"idBoard\":\"51478f6469fd3d9341001dae\",\"name\":\"orange\",\"color\":\"orange\"},{\"id\":\"54737da6c22a888c1f5bfa7e\",\"idBoard\":\"51478f6469fd3d9341001dae\",\"name\":\"Other Blue Label\",\"color\":\"blue\"}],\"idLabels\":[\"54737da6c22a888c1f5bfa7e\",\"5475f8a629b56a928f0b20fa\",\"545b37fa74d650d567d4c15a\"],\"manualCoverAttachment\":false,\"name\":\"Card\",\"pos\":163839.5,\"shortLink\":\"3rm0AZg5\",\"shortUrl\":\"https://trello.com/c/3rm0AZg5\",\"subscribed\":false,\"url\":\"https://trello.com/c/3rm0AZg5/1344-card\"}"; var webhookData = "{\"model\":{\"id\":\"5a72b7ab3711a44643c5ed49\",\"badges\":{\"votes\":0,\"attachmentsByType\":{\"trello\":{\"board\":0,\"card\":0}},\"viewingMemberVoted\":false,\"subscribed\":false,\"fogbugz\":\"\",\"checkItems\":2,\"checkItemsChecked\":1,\"comments\":1,\"attachments\":1,\"description\":true,\"due\":null,\"dueComplete\":false},\"checkItemStates\":[{\"idCheckItem\":\"5aa7a08854b35d7eb0c497db\",\"state\":\"complete\"}],\"closed\":false,\"dueComplete\":false,\"dateLastActivity\":\"2018-05-19T00:06:58.640Z\",\"desc\":\"changing the description to trigger a webhook\\n\",\"descData\":{\"emoji\":{}},\"due\":null,\"email\":null,\"idBoard\":\"51478f6469fd3d9341001dae\",\"idChecklists\":[\"5aa7a081fa623ac86b7856e1\"],\"idList\":\"51478f6469fd3d9341001daf\",\"idMembers\":[\"50b693ad6f122b4310000a3c\"],\"idMembersVoted\":[],\"idShort\":1344,\"idAttachmentCover\":\"5a72b801baac36a68ea5c10b\",\"labels\":[{\"id\":\"5475f8a629b56a928f0b20fa\",\"idBoard\":\"51478f6469fd3d9341001dae\",\"name\":\"Colorless Label\",\"color\":null},{\"id\":\"545b37fa74d650d567d4c15a\",\"idBoard\":\"51478f6469fd3d9341001dae\",\"name\":\"orange\",\"color\":\"orange\"},{\"id\":\"54737da6c22a888c1f5bfa7e\",\"idBoard\":\"51478f6469fd3d9341001dae\",\"name\":\"Other Blue Label\",\"color\":\"blue\"}],\"idLabels\":[\"54737da6c22a888c1f5bfa7e\",\"5475f8a629b56a928f0b20fa\",\"545b37fa74d650d567d4c15a\"],\"manualCoverAttachment\":false,\"name\":\"Card\",\"pos\":163839.5,\"shortLink\":\"3rm0AZg5\",\"shortUrl\":\"https://trello.com/c/3rm0AZg5\",\"subscribed\":false,\"url\":\"https://trello.com/c/3rm0AZg5/1344-card\"},\"action\":{\"id\":\"5aff6aa258f856835962fd6f\",\"idMemberCreator\":\"50b693ad6f122b4310000a3c\",\"data\":{\"list\":{\"name\":\"List\",\"id\":\"51478f6469fd3d9341001daf\"},\"board\":{\"shortLink\":\"VHHdzCU0\",\"name\":\"Sandbox\",\"id\":\"51478f6469fd3d9341001dae\"},\"card\":{\"shortLink\":\"3rm0AZg5\",\"idShort\":1344,\"name\":\"Card\",\"id\":\"5a72b7ab3711a44643c5ed49\",\"desc\":\"changing the description to trigger a webhook\\n\"},\"old\":{\"desc\":\"a description\"}},\"type\":\"updateCard\",\"date\":\"2018-05-19T00:06:58.644Z\",\"limits\":{},\"display\":{\"translationKey\":\"action_changed_description_of_card\",\"entities\":{\"card\":{\"type\":\"card\",\"desc\":\"changing the description to trigger a webhook\\n\",\"id\":\"5a72b7ab3711a44643c5ed49\",\"shortLink\":\"3rm0AZg5\",\"text\":\"Card\"},\"memberCreator\":{\"type\":\"member\",\"id\":\"50b693ad6f122b4310000a3c\",\"username\":\"gregsdennis\",\"text\":\"Greg Dennis\"}}},\"memberCreator\":{\"id\":\"50b693ad6f122b4310000a3c\",\"avatarHash\":\"cfd323494c6c01459001e53c35e88e41\",\"avatarUrl\":\"https://trello-avatars.s3.amazonaws.com/cfd323494c6c01459001e53c35e88e41\",\"fullName\":\"Greg Dennis\",\"initials\":\"GSD\",\"username\":\"gregsdennis\"}}}"; MockHost.MockRest <IJsonCard>(cardData); var card = _factory.Card(TrelloIds.CardId); await card.Refresh(); card.Updated += (c, list) => properties = list.ToList(); TrelloProcessor.ProcessNotification(webhookData); properties.Count.Should().Be(1); properties.Should().Contain(new[] { "Description" }); } finally { if (properties != null) { Console.WriteLine(string.Join("\n", properties)); } MockHost.ResetRest(); TrelloConfiguration.Cache.Clear(); } }
public void Issue45_DueDateAsMinValue() { Card card = null; try { var serializer = new ManateeSerializer(); TrelloConfiguration.Serializer = serializer; TrelloConfiguration.Deserializer = serializer; TrelloConfiguration.JsonFactory = new ManateeFactory(); TrelloConfiguration.RestClientProvider = new WebApiClientProvider(); TrelloAuthorization.Default.AppKey = TrelloIds.AppKey; TrelloAuthorization.Default.UserToken = TrelloIds.UserToken; var list = new List(TrelloIds.ListId); card = list.Cards.Add("min date test"); card.Description = "a description"; card.DueDate = DateTime.MinValue; TrelloProcessor.Flush(); } finally { card?.Delete(); } }
public async Task CanCopy() { var checkList = await TestEnvironment.Current.BuildCheckList(); var card = await TestEnvironment.Current.BuildCard(); await checkList.CheckItems.Add("one"); var checkItem = await checkList.CheckItems.Add("two"); checkItem.State = CheckItemState.Complete; await TrelloProcessor.Flush(); await checkItem.Refresh(); checkItem.State.Should().Be(CheckItemState.Complete); var newCheckList = await card.CheckLists.Add("copied", checkList); newCheckList.Name.Should().Be("copied"); newCheckList.CheckItems.Count().Should().Be(2); newCheckList.CheckItems[0].Name.Should().Be("one"); newCheckList.CheckItems[1].Name.Should().Be("two"); // Trello does not copy item state newCheckList.CheckItems[1].State.Should().Be(CheckItemState.Incomplete); }
public async Task MovingACard() { var board = TestEnvironment.Current.Board; async Task MoveCard(string cardId, string listId) { await board.Refresh(true); var card = TestEnvironment.Current.Factory.Card(cardId); var list = board.Lists.FirstOrDefault(x => x.Id == listId); if (card == null || list == null) { return; } card.List = list; } var testCard = await TestEnvironment.Current.BuildCard(); var destinationList = await TestEnvironment.Current.BuildList(nameof(MovingACard) + " Destination"); await MoveCard(testCard.Id, destinationList.Id); await TrelloProcessor.Flush(); }
public async Task BasicData() { try { var board = TestEnvironment.Current.Board; board.Description = "changed"; board.Name = "changed also"; board.IsClosed = true; board.IsSubscribed = true; await TrelloProcessor.Flush(); await TestEnvironment.RunClean(async() => { var reBoard = TestEnvironment.Current.Factory.Board(board.Id); await reBoard.Refresh(); reBoard.Description.Should().Be("changed"); reBoard.Name.Should().Be("changed also"); reBoard.IsClosed.Should().Be(true); reBoard.IsSubscribed.Should().Be(true); }); } finally { TestEnvironment.Current.Board.IsClosed = false; await TrelloProcessor.Flush(); } }
public async Task CanChangeOrg() { try { var board = TestEnvironment.Current.Board; var org = TestEnvironment.Current.Factory.Organization("littlecrabsolutions"); await org.Refresh(); board.Organization = org; await TrelloProcessor.Flush(); TrelloConfiguration.Cache.Remove(board); var reBoard = TestEnvironment.Current.Factory.Board(board.Id); await reBoard.Refresh(); TrelloConfiguration.Cache.Remove(reBoard); reBoard.Organization.Should().Be(org); } finally { TestEnvironment.Current.Board.Organization = TestEnvironment.Current.Organization; await TrelloProcessor.Flush(); TrelloConfiguration.Cache.Add(TestEnvironment.Current.Board); } }
public async Task Issue59_EditComments() { ICard card = null; var name = "edit comment test"; try { TrelloAuthorization.Default.AppKey = TrelloIds.AppKey; var list = _factory.List(TrelloIds.ListId); card = await list.Cards.Add(name); var comment = await card.Comments.Add("This is a comment"); comment.Data.Text = "This comment was changed."; Thread.Sleep(5); await TrelloProcessor.Flush(); } finally { card?.Delete(); } }
public async Task BasicData() { try { var board = TestEnvironment.Current.Board; board.Description = "changed"; board.Name = "changed also"; board.IsClosed = true; board.IsSubscribed = true; await TrelloProcessor.Flush(); TrelloConfiguration.Cache.Remove(board); var reBoard = TestEnvironment.Current.Factory.Board(board.Id); await reBoard.Refresh(); TrelloConfiguration.Cache.Remove(reBoard); reBoard.Description.Should().Be("changed"); reBoard.Name.Should().Be("changed also"); reBoard.IsClosed.Should().Be(true); reBoard.IsSubscribed.Should().Be(true); } finally { TestEnvironment.Current.Board.IsClosed = false; await TrelloProcessor.Flush(); TrelloConfiguration.Cache.Add(TestEnvironment.Current.Board); } }
public void Issue35_DatesReturningAs1DayBefore() { Card card = null; try { var serializer = new ManateeSerializer(); TrelloConfiguration.Serializer = serializer; TrelloConfiguration.Deserializer = serializer; TrelloConfiguration.JsonFactory = new ManateeFactory(); TrelloConfiguration.RestClientProvider = new WebApiClientProvider(); TrelloAuthorization.Default.AppKey = TrelloIds.AppKey; TrelloAuthorization.Default.UserToken = TrelloIds.UserToken; var learningBoard = new Board(TrelloIds.BoardId); string listId = learningBoard.Lists.First().Id; var list = new List(listId); var member = list.Board.Members.First(); card = list.Cards.Add("test card 2"); card.DueDate = new DateTime(2016, 07, 21); TrelloProcessor.Flush(); var cardCopy = new Card(card.Id); Assert.AreEqual(new DateTime(2016, 07, 21), cardCopy.DueDate); } finally { card?.Delete(); } }
public async Task Issue35_DatesReturningAs1DayBefore() { ICard card = null; try { TrelloAuthorization.Default.AppKey = TrelloIds.AppKey; var learningBoard = _factory.Board(TrelloIds.BoardId); await learningBoard.Lists.Refresh(); var list = learningBoard.Lists.First(); var member = list.Board.Members.First(); card = await list.Cards.Add("test card 2"); card.DueDate = new DateTime(2016, 07, 21); await TrelloProcessor.Flush(); var cardCopy = _factory.Card(card.Id); Assert.AreEqual(new DateTime(2016, 07, 21), cardCopy.DueDate); } finally { card?.Delete(); } }
public async Task BasicCardData() { var card = await TestEnvironment.Current.BuildCard(); var date = DateTime.Now; card.Name = "changed"; card.Description = "changed also"; card.DueDate = date; card.IsArchived = true; card.IsComplete = true; card.Position = 157; card.IsSubscribed = true; await TrelloProcessor.Flush(); TrelloConfiguration.Cache.Remove(card); var reCard = TestEnvironment.Current.Factory.Card(card.Id); await reCard.Refresh(); reCard.Name.Should().Be("changed"); reCard.Description.Should().Be("changed also"); reCard.DueDate.Should().Be(date.Truncate(TimeSpan.FromMilliseconds(1))); reCard.IsArchived.Should().Be(true); reCard.IsComplete.Should().Be(true); reCard.Position.Should().Be(157); reCard.IsSubscribed.Should().Be(true); reCard.ShortId.Should().NotBeNull(); reCard.Url.Should().NotBeNullOrEmpty(); reCard.ShortUrl.Should().NotBeNullOrEmpty(); reCard.LastActivity.Should().NotBeNull(); reCard.Board.Should().Be(TestEnvironment.Current.Board); }
public void Issue37_InconsistentDateEncoding() { Card card = null; try { var serializer = new ManateeSerializer(); TrelloConfiguration.Serializer = serializer; TrelloConfiguration.Deserializer = serializer; TrelloConfiguration.JsonFactory = new ManateeFactory(); TrelloConfiguration.RestClientProvider = new WebApiClientProvider(); TrelloAuthorization.Default.AppKey = TrelloIds.AppKey; TrelloAuthorization.Default.UserToken = TrelloIds.UserToken; var list = new List(TrelloIds.ListId); card = list.Cards.Add("date encoding test"); // 2016-12-08T04:45:00.000Z var date = Convert.ToDateTime("8/12/2016 5:45:00PM"); card.DueDate = date; TrelloProcessor.Flush(); } finally { card?.Delete(); } }
private static async Task Run(Func <Task> action) { TrelloAuthorization.Default.AppKey = TrelloIds.AppKey; await action(); await TrelloProcessor.Flush(); }
private static async Task Run(Func <CancellationToken, Task> action) { TrelloAuthorization.Default.AppKey = TrelloIds.AppKey; TrelloAuthorization.Default.UserToken = TrelloIds.UserToken; await action(CancellationToken.None); await TrelloProcessor.Flush(); }
private static async Task Run(Func <CancellationToken, Task> action) { TrelloAuthorization.Default.AppKey = TrelloIds.AppKey; TrelloAuthorization.Default.UserToken = Environment.GetEnvironmentVariable("TRELLO_USER_TOKEN"); await action(CancellationToken.None); await TrelloProcessor.Flush(); }
public void TestMethod1() { Run(() => { var list = new List(TrelloIds.ListId); var cards = list.Cards.Filter(CardFilter.Visible); OutputCollection("cards", cards); TrelloProcessor.Flush(); }); }
static void Main(string[] args) { Run(() => { var card = new Card("js8Ygw89"); Console.WriteLine(card.Board.Id); Console.WriteLine(); Console.WriteLine(Member.Me); TrelloProcessor.Flush(); }); }
static void Main(string[] args) { Run(() => { var board = new Board(TrelloIds.BoardId); var type = board.PowerUps[0].GetType(); Console.WriteLine(board.PowerUps[0].Name); Console.WriteLine(board.PowerUps[0].Id); Console.WriteLine(type); TrelloProcessor.Flush(); }); }
static void RunScript(string board_id) { TrelloOps.Initialize(); var board = new Board(board_id); if (DateTime.Now.DayOfWeek == DayOfWeek.Sunday) { board.Lists.ByName("Next Week").MoveAllCards(board.Lists.ByName("This Week")); } //LabelUnfinishedCards(board); ArchiveCompletedCards(board); MoveTodaysCards(board); TrelloProcessor.Flush(); }
public async Task Issue30_PartialSearch_False() { TrelloAuthorization.Default.AppKey = TrelloIds.AppKey; var board = _factory.Board(TrelloIds.BoardId); var searchText = "car"; var search = _factory.Search(_factory.SearchQuery().Text(searchText), modelTypes: SearchModelType.Cards, context: new[] { board }); await search.Refresh(); Assert.AreEqual(0, search.Cards.Count()); await TrelloProcessor.Flush(); }
public void Run() { Board board = null; try { board = Member.Me.Boards.Add($"TestBoard{Guid.NewGuid()}"); } finally { board?.Delete(); TrelloProcessor.Flush(); } }
public async Task Issue30_PartialSearch_True() { TrelloAuthorization.Default.AppKey = TrelloIds.AppKey; var board = _factory.Board(TrelloIds.BoardId); var searchText = "car"; var search = _factory.Search(_factory.SearchQuery().Text(searchText), modelTypes: SearchModelType.Cards, context: new[] { board }, isPartial: true); await search.Refresh(); // search will include archived cards as well as matches in card descriptions. Assert.AreEqual(6, search.Cards.Count()); await TrelloProcessor.Flush(); }
private static void Run(System.Action action) { var serializer = new ManateeSerializer(); TrelloConfiguration.Serializer = serializer; TrelloConfiguration.Deserializer = serializer; TrelloConfiguration.JsonFactory = new ManateeFactory(); TrelloConfiguration.RestClientProvider = new WebApiClientProvider(); TrelloAuthorization.Default.AppKey = TrelloIds.AppKey; TrelloAuthorization.Default.UserToken = TrelloIds.UserToken; action(); TrelloProcessor.Flush(); }
public async Task Run() { IBoard board = null; try { var me = await _factory.Me(); board = await me.Boards.Add($"TestBoard{Guid.NewGuid()}"); } finally { board?.Delete(); await TrelloProcessor.Flush(); } }
public async Task MoveCheckItem() { var checkItem = await TestEnvironment.Current.BuildCheckItem(); var source = checkItem.CheckList; var destination = await checkItem.CheckList.Card.CheckLists.Add("other checklist"); checkItem.CheckList = destination; await TrelloProcessor.Flush(); await source.Refresh(); await destination.Refresh(); source.CheckItems.Should().NotContain(checkItem); destination.CheckItems.Should().Contain(checkItem); }
public async Task BasicData() { var checkList = await TestEnvironment.Current.BuildCheckList(); checkList.Name = "changed"; checkList.Position = 157; await TrelloProcessor.Flush(); TrelloConfiguration.Cache.Remove(checkList); var reCheckList = TestEnvironment.Current.Factory.CheckList(checkList.Id); await reCheckList.Refresh(); reCheckList.Name.Should().Be("changed"); reCheckList.Position.Should().Be(157); }
public async Task ChangeList() { var card = await TestEnvironment.Current.BuildCard(); var list = await TestEnvironment.Current.BuildList(); await card.Refresh(); card.List = list; await TrelloProcessor.Flush(); TrelloConfiguration.Cache.Remove(card); var reCard = TestEnvironment.Current.Factory.Card(card.Id); await reCard.Refresh(); reCard.List.Id.Should().Be(list.Id); }