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 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(); } }
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 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 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 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 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 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 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 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 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 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 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(); } }
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 = Environment.GetEnvironmentVariable("TRELLO_USER_TOKEN"); await action(CancellationToken.None); 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(); }
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 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 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 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); }
public void Issue30_PartialSearch_False() { 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 board = new Board(TrelloIds.BoardId); var searchText = "car"; var search = new Search(SearchFor.Text(searchText), modelTypes: SearchModelType.Cards, context: new[] { board }); Assert.AreEqual(0, search.Cards.Count()); TrelloProcessor.Flush(); }
public void Issue47_AddCardWithDetails() { Card card = null; var name = "card detailed creation test"; var description = "this is a description"; var position = Position.Top; var dueDate = new DateTime(2014, 1, 1); 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 members = new Member[] { Member.Me }; var board = new Board(TrelloIds.BoardId); var labels = new[] { board.Labels.FirstOrDefault(l => l.Color == LabelColor.Blue) }; var list = new List(TrelloIds.ListId); card = list.Cards.Add(name, description, position, dueDate, true, members, labels); var recard = new Card(card.Id); Assert.AreEqual(name, recard.Name); Assert.AreEqual(description, recard.Description); Assert.AreEqual(card.Id, list.Cards.First().Id); Assert.AreEqual(dueDate, recard.DueDate); Assert.IsTrue(recard.IsComplete.Value, "card not complete"); Assert.IsTrue(recard.Members.Contains(Member.Me), "member not found"); Assert.IsTrue(recard.Labels.Contains(labels[0]), "label not found"); TrelloProcessor.Flush(); } finally { card?.Delete(); } }