diff --git a/TrelloNet.Tests/ActionTests.cs b/TrelloNet.Tests/ActionTests.cs index 68ee2f5..a4782c9 100644 --- a/TrelloNet.Tests/ActionTests.cs +++ b/TrelloNet.Tests/ActionTests.cs @@ -10,7 +10,7 @@ namespace TrelloNet.Tests public class ActionTests : TrelloTestBase { private const string TrellonetTestUser = "4f2b8b464f2cb9d16d368326"; - private const string TestUser = "4ece5a165237e5db06624a2a"; + private const string TestUser = "4f9e6801644163614d59db73"; [Test] public void WithId_Null_Throws() @@ -22,19 +22,25 @@ public void WithId_Null_Throws() [Test] public void WithId_ARemoveMemberFromCardAction_ReturnsExpectedAction() { - const string actionId = "4f3f58ee3374646b5c1693d7"; + const string actionId = "54906629873b68a7cdb49663"; var expected = new RemoveMemberFromCardAction { Id = actionId, IdMemberCreator = TestUser, - Date = new DateTime(2012, 02, 18, 07, 53, 18, 696), + Date = new DateTime(2014, 12, 16, 17, 04, 41, 121), Data = new RemoveMemberFromCardAction.ActionData { Board = TheWelcomeBoard(), - Card = TheLearnTricksCard(), - IdMember = TrellonetTestUser + Card = new CardName + { + Id = "5490661c5165d3c9cdcf2e83", + Name = "Testing membership", + IdShort = 45, + ShortLink = "rTIw2Z1E" + }, + IdMember = TestUser }, - MemberCreator = CreateActionMemberOskar() + MemberCreator = CreateActionMemberCDW() }.ToExpectedObject(); var actual = _trelloReadOnly.Actions.WithId(actionId); @@ -45,20 +51,20 @@ public void WithId_ARemoveMemberFromCardAction_ReturnsExpectedAction() [Test] public void WithId_AnAddMemberToCardAction_ReturnsExpectedAction() { - const string actionId = "4f3f58e33374646b5c16929a"; + const string actionId = "54900fb95e34f82c5d39506f"; var expected = new AddMemberToCardAction { Id = actionId, - IdMemberCreator = TestUser, - Date = new DateTime(2012, 02, 18, 07, 53, 07, 042), + IdMemberCreator = "4f9e6801644163614d59db73", + Date = new DateTime(2014, 12, 16, 10, 55, 53, 973), Data = new AddMemberToCardAction.ActionData { Board = TheWelcomeBoard(), Card = TheLearnTricksCard(), - IdMember = TrellonetTestUser + IdMember = "4f9e6801644163614d59db73" }, - MemberCreator = CreateActionMemberOskar(), - Member = CreateActionMemberMe() + MemberCreator = CreateActionMemberCDW(), + Member = CreateActionMemberCDW() }.ToExpectedObject(); var actual = _trelloReadOnly.Actions.WithId(actionId); @@ -69,23 +75,25 @@ public void WithId_AnAddMemberToCardAction_ReturnsExpectedAction() [Test] public void WithId_ACommentCardAction_ReturnsExpectedAction() { - const string actionId = "4f3f5d073cf351b24302417d"; + const string actionId = Constants.TestActionId; var expected = new CommentCardAction { Id = actionId, IdMemberCreator = TestUser, - Date = new DateTime(2012, 02, 18, 08, 10, 47, 335), + Date = new DateTime(2014, 12, 15, 10, 51, 43, 025), Data = new CommentCardAction.ActionData { Board = TheWelcomeBoard(), Card = new CardName { - Id = "4f2b8b4d4f2cb9d16d3684e6", - Name = "Welcome to Trello!" + Id = Constants.WelcomeCardOfTheWelcomeBoardId, + Name = Constants.TestCardName1, + ShortLink = "21UnMVtO", + IdShort = 1 }, Text = "A test comment" }, - MemberCreator = CreateActionMemberOskar() + MemberCreator = CreateActionMemberCDW() }.ToExpectedObject(); var actual = _trelloReadOnly.Actions.WithId(actionId); @@ -96,24 +104,23 @@ public void WithId_ACommentCardAction_ReturnsExpectedAction() [Test] public void WithId_AnAddAttachmentToCardAction_ReturnsExpectedAction() { - const string actionId = "4f49c85a38b425570c18033a"; + const string actionId = "54901966c89082bbf3580167"; var expected = new AddAttachmentToCardAction { Id = actionId, - IdMemberCreator = TrellonetTestUser, - Date = new DateTime(2012, 02, 26, 05, 51, 22, 200), + IdMemberCreator = "4f9e6801644163614d59db73", + Date = new DateTime(2014, 12, 16, 11, 37, 10, 314), Data = new AddAttachmentToCardAction.ActionData { Board = TheWelcomeBoard(), Card = TheWelcomeCard(), Attachment = new AttachmentLink { - Id = "4f49c85a38b425570c180338", + Id = "54901964c89082bbf358015e", Name = "Penguins.jpg", - Url = "https://trello-attachments.s3.amazonaws.com/4f2b8b4d4f2cb9d16d3684c9/4f2b8b4d4f2cb9d16d3684e6/xsMvxPpz55JpWVqIMxENcVXKxOkx/Penguins.jpg" } }, - MemberCreator = CreateActionMemberMe() + MemberCreator = CreateActionMemberCDW() }.ToExpectedObject(); var actual = _trelloReadOnly.Actions.WithId(actionId); @@ -124,23 +131,23 @@ public void WithId_AnAddAttachmentToCardAction_ReturnsExpectedAction() [Test] public void WithId_ADeleteAttachmentFromCardAction_ReturnsExpectedAction() { - const string actionId = "4f6e48d47f4c6c2b35aa45ce"; + const string actionId = "54901979f260ad67880938c0"; var expected = new DeleteAttachmentFromCardAction { Id = actionId, - IdMemberCreator = TrellonetTestUser, - Date = new DateTime(2012, 03, 24, 22, 21, 08, 925), + IdMemberCreator = "4f9e6801644163614d59db73", + Date = new DateTime(2014, 12, 16, 11, 37, 29, 395), Data = new DeleteAttachmentFromCardAction.ActionData { Board = TheWelcomeBoard(), Card = TheWelcomeCard(), Attachment = new AttachmentName { - Id = "4f49c85a38b425570c180338", + Id = "54901964c89082bbf358015e", Name = "Penguins.jpg" } }, - MemberCreator = CreateActionMemberMe() + MemberCreator = CreateActionMemberCDW() }.ToExpectedObject(); var actual = _trelloReadOnly.Actions.WithId(actionId); @@ -151,17 +158,17 @@ public void WithId_ADeleteAttachmentFromCardAction_ReturnsExpectedAction() [Test] public void WithId_ACreateBoardAction_ReturnsExpectedAction() { - const string actionId = "4f2b8b4d4f2cb9d16d3685ef"; + const string actionId = "546f22e5cb8013103defe720"; var expected = new CreateBoardAction { Id = actionId, - IdMemberCreator = "4e6a7fad05d98b02ba00845c", - Date = new DateTime(2011, 09, 09, 21, 09, 41, 515), + IdMemberCreator = "4f9e6801644163614d59db73", + Date = new DateTime(2014, 11, 21, 11, 32, 53, 939), Data = new CreateBoardAction.ActionData { Board = TheWelcomeBoard() }, - MemberCreator = CreateActionMemberTrello() + MemberCreator = CreateActionMemberCDW() }.ToExpectedObject(); var actual = _trelloReadOnly.Actions.WithId(actionId); @@ -172,27 +179,29 @@ public void WithId_ACreateBoardAction_ReturnsExpectedAction() [Test] public void WithId_ACreateCardAction_ReturnsExpectedAction() { - const string actionId = "4f2b9771433e15f21e004b33"; + const string actionId = "548af14b89034704dbdb9f49"; var expected = new CreateCardAction { Id = actionId, - IdMemberCreator = TrellonetTestUser, - Date = new DateTime(2012, 02, 03, 08, 14, 41, 452), + IdMemberCreator = "4f9e6801644163614d59db73", + Date = new DateTime(2014, 12, 12, 13, 44, 43, 045), Data = new CreateCardAction.ActionData { Board = TheWelcomeBoard(), Card = new CardName { - Id = "4f2b9771433e15f21e004b31", - Name = "A closed card" + Id = "548af14b89034704dbdb9f48", + Name = "This card has labels", + IdShort = 4, + ShortLink = "3c7t5TNM" }, List = new ListName { - Id = "4f2b8b4d4f2cb9d16d3684c1", - Name = "Basics" + Id = "5489c9541410d7d4cf8622a2", + Name = "Advanced" } }, - MemberCreator = CreateActionMemberMe() + MemberCreator = CreateActionMemberCDW() }.ToExpectedObject(); var actual = _trelloReadOnly.Actions.WithId(actionId); @@ -203,18 +212,18 @@ public void WithId_ACreateCardAction_ReturnsExpectedAction() [Test] public void WithId_AnAddMemberToBoardAction_ReturnsExpectedAction() { - const string actionId = "4f359bd2655ca8cf3f047648"; + const string actionId = "546f230f872765f52bf3d939"; var expected = new AddMemberToBoardAction { Id = actionId, - IdMemberCreator = TestUser, - Date = new DateTime(2012, 02, 10, 22, 36, 02, 209), + IdMemberCreator = "4f9e6801644163614d59db73", + Date = new DateTime(2014, 11, 21, 11, 33, 35, 100), Data = new AddMemberToBoardAction.ActionData { Board = TheWelcomeBoard(), - IdMember = "4ece5a165237e5db06624a2a" + IdMemberAdded = "510beb791b14e0016b008019" }, - MemberCreator = CreateActionMemberOskar() + MemberCreator = CreateActionMemberCDW() }.ToExpectedObject(); var actual = _trelloReadOnly.Actions.WithId(actionId); @@ -222,7 +231,7 @@ public void WithId_AnAddMemberToBoardAction_ReturnsExpectedAction() expected.ShouldEqual(actual); } - [Test] + [Test, Ignore("These events are not creating actions anymore")] public void WithId_ARemoveMemberFromBoardAction_ReturnsExpectedAction() { const string actionId = "4f71afaa9301d09b6b71b03e"; @@ -244,7 +253,7 @@ public void WithId_ARemoveMemberFromBoardAction_ReturnsExpectedAction() expected.ShouldEqual(actual); } - [Test] + [Test, Ignore("These events are not creating actions anymore")] public void WithId_AnAddToOrganizationBoardAction_ReturnsExpectedAction() { const string actionId = "4f2b950cc1c87fcb65424143"; @@ -273,21 +282,27 @@ public void WithId_AnAddToOrganizationBoardAction_ReturnsExpectedAction() [Test] public void WithId_ARemoveFromOrganizationBoardAction_ReturnsExpectedAction() { - const string actionId = "4f724a4eb2cfd3503742846d"; + const string actionId = "5490668b52c1dc90355259da"; var expected = new RemoveFromOrganizationBoardAction { Id = actionId, - IdMemberCreator = TrellonetTestUser, - Date = new DateTime(2012, 03, 27, 23, 16, 30, 715), + IdMemberCreator = TestUser, + Date = new DateTime(2014, 12, 16, 17, 06, 19, 723), Data = new RemoveFromOrganizationBoardAction.ActionData { Board = new BoardName - { - Id = "4f724760b2cfd3503741bf2a", - Name = "test" - } - }, - MemberCreator = CreateActionMemberMe() + { + Id = "546f22e5cb8013103defe71e", + Name = "Trello.NET Test Board", + ShortLink = "UTWsO3Jc" + }, + Organization = new OrganizationName + { + Id = "548b0039e035cf051fb0633d", + Name = "Test Organisation" + } + }, + MemberCreator = CreateActionMemberCDW() }.ToExpectedObject(); var actual = _trelloReadOnly.Actions.WithId(actionId); @@ -298,27 +313,29 @@ public void WithId_ARemoveFromOrganizationBoardAction_ReturnsExpectedAction() [Test] public void WithId_AnAddChecklistToCardAction_ReturnsExpectedAction() { - const string actionId = "4f2b8b4d4f2cb9d16d3685c0"; + const string actionId = "5489c8f481bb7d5b780be291"; var expected = new AddChecklistToCardAction { Id = actionId, - IdMemberCreator = "4e6a7fad05d98b02ba00845c", - Date = new DateTime(2011, 09, 09, 21, 12, 14, 066), + IdMemberCreator = "4f9e6801644163614d59db73", + Date = new DateTime(2014, 12, 11, 16, 40, 20, 981), Data = new AddChecklistToCardAction.ActionData { Board = TheWelcomeBoard(), Card = new CardName { - Id = "4f2b8b4d4f2cb9d16d3684fc", - Name = "... or checklists." + Id = "5489c8eb0caf1a3c4598087b", + Name = "A third test card", + IdShort = 3, + ShortLink = "iAZ5wSWl" }, Checklist = new ChecklistName { - Id = "4f2b8b4d4f2cb9d16d3684c7", + Id = "5489c8f481bb7d5b780be290", Name = "Checklist" } }, - MemberCreator = CreateActionMemberTrello() + MemberCreator = CreateActionMemberCDW() }.ToExpectedObject(); var actual = _trelloReadOnly.Actions.WithId(actionId); @@ -329,23 +346,29 @@ public void WithId_AnAddChecklistToCardAction_ReturnsExpectedAction() [Test] public void WithId_ARemoveChecklistFromCardAction_ReturnsExpectedAction() { - const string actionId = "4f6e4f3ac962a0e45621ab14"; + const string actionId = "5490509f5842f766e2cf7203"; var expected = new RemoveChecklistFromCardAction { Id = actionId, - IdMemberCreator = TrellonetTestUser, - Date = new DateTime(2012, 03, 24, 22, 48, 26, 594), + IdMemberCreator = "4f9e6801644163614d59db73", + Date = new DateTime(2014, 12, 16, 15, 32, 47, 076), Data = new RemoveChecklistFromCardAction.ActionData { Board = TheWelcomeBoard(), - Card = TheWelcomeCard(), + Card = new CardName + { + Id = "5489c83a30bf250d785224b5", + Name = "Welcome to Trello!", + IdShort = 2, + ShortLink = "SyBfTUYS" + }, Checklist = new ChecklistName { - Id = "4f6e4f2bc962a0e45621aa8e", - Name = "TestCheckList" + Id = "5490509d52c1dc903552398b", + Name = "a test checklist" } }, - MemberCreator = CreateActionMemberMe() + MemberCreator = CreateActionMemberCDW() }.ToExpectedObject(); var actual = _trelloReadOnly.Actions.WithId(actionId); @@ -356,28 +379,30 @@ public void WithId_ARemoveChecklistFromCardAction_ReturnsExpectedAction() [Test] public void WithId_AnUpdateCheckItemStateOnCardAction_ReturnsExpectedAction() { - const string actionId = "4f2b8b4d4f2cb9d16d3685bd"; + const string actionId = "5489c910dd356581ed12f5b1"; var expected = new UpdateCheckItemStateOnCardAction { Id = actionId, - IdMemberCreator = "4e6a7fad05d98b02ba00845c", - Date = new DateTime(2011, 09, 09, 21, 12, 33, 064), + IdMemberCreator = "4f9e6801644163614d59db73", + Date = new DateTime(2014, 12, 11, 16, 40, 48, 921), Data = new UpdateCheckItemStateOnCardAction.ActionData { Board = TheWelcomeBoard(), Card = new CardName { - Id = "4f2b8b4d4f2cb9d16d3684fc", - Name = "... or checklists." + Id = "5489c8eb0caf1a3c4598087b", + Name = "A third test card", + IdShort = 3, + ShortLink = "iAZ5wSWl" }, CheckItem = new CheckItemWithState { - Id = "4f2b8b4d4f2cb9d16d3684c4", - Name = "Make your own boards", + Id = "5489c8fd46994a811b89fdbc", + Name = "Make your own board", State = "complete" } }, - MemberCreator = CreateActionMemberTrello() + MemberCreator = CreateActionMemberCDW() }.ToExpectedObject(); var actual = _trelloReadOnly.Actions.WithId(actionId); @@ -388,22 +413,22 @@ public void WithId_AnUpdateCheckItemStateOnCardAction_ReturnsExpectedAction() [Test] public void WithId_ACreateListAction_ReturnsExpectedAction() { - const string actionId = "4f6e4fca255ed1e908575823"; + const string actionId = "5489c9541410d7d4cf8622a3"; var expected = new CreateListAction { Id = actionId, - IdMemberCreator = TrellonetTestUser, - Date = new DateTime(2012, 03, 24, 22, 50, 50, 103), + IdMemberCreator = "4f9e6801644163614d59db73", + Date = new DateTime(2014, 12, 11, 16, 41, 56, 737), Data = new CreateListAction.ActionData { Board = TheWelcomeBoard(), List = new ListName { - Id = "4f6e4fca255ed1e908575821", - Name = "Test" + Id = "5489c9541410d7d4cf8622a2", + Name = "Advanced" } }, - MemberCreator = CreateActionMemberMe() + MemberCreator = CreateActionMemberCDW() }.ToExpectedObject(); var actual = _trelloReadOnly.Actions.WithId(actionId); @@ -411,14 +436,14 @@ public void WithId_ACreateListAction_ReturnsExpectedAction() expected.ShouldEqual(actual); } - [Test] + [Test, Ignore("These events are not creating actions anymore")] public void WithId_ACreateOrganizationAction_ReturnsExpectedAction() { const string actionId = "4f2b94c0c1c87fcb65422346"; var expected = new CreateOrganizationAction { Id = actionId, - IdMemberCreator = TrellonetTestUser, + IdMemberCreator = "4f9e6801644163614d59db73", Date = new DateTime(2012, 02, 03, 08, 03, 12, 984), Data = new CreateOrganizationAction.ActionData { @@ -428,7 +453,7 @@ public void WithId_ACreateOrganizationAction_ReturnsExpectedAction() Name = "Trello.NET Test Organization" } }, - MemberCreator = CreateActionMemberMe() + MemberCreator = CreateActionMemberCDW() }.ToExpectedObject(); var actual = _trelloReadOnly.Actions.WithId(actionId); @@ -439,71 +464,74 @@ public void WithId_ACreateOrganizationAction_ReturnsExpectedAction() [Test] public void WithId_AnUpdateBoardAction_ReturnsExpectedAction() { - const string actionId = "4f2b9477c1c87fcb654209f0"; + const string actionId = "549054ed5842f766e2cf776d"; var actual = (UpdateBoardAction)_trelloReadOnly.Actions.WithId(actionId); Assert.That(actual.Id, Is.EqualTo(actionId)); - Assert.That(actual.IdMemberCreator, Is.EqualTo(TrellonetTestUser)); - Assert.That(actual.Date, Is.EqualTo(new DateTime(2012, 02, 03, 08, 01, 59, 229))); - Assert.That(actual.Data.Board.Name, Is.EqualTo("Welcome Board")); - Assert.That(actual.Data.Board.Id, Is.EqualTo("4f2b8b4d4f2cb9d16d3684c9")); - Assert.That((string)actual.Data.Old.Value, Is.EqualTo("")); - Assert.That(actual.Data.Old.PropertyName, Is.EqualTo("desc")); + Assert.That(actual.IdMemberCreator, Is.EqualTo(TestUser)); + Assert.That(actual.Date, Is.EqualTo(new DateTime(2014, 12, 16, 15, 51, 09, 832))); + Assert.That(actual.Data.Board.Name, Is.EqualTo(Constants.TestBoardName)); + Assert.That(actual.Data.Board.Id, Is.EqualTo("546f22e5cb8013103defe71e")); + Assert.That((string)actual.Data.Old.Value, Is.EqualTo("True")); + Assert.That(actual.Data.Old.PropertyName, Is.EqualTo("closed")); } [Test] public void WithId_AnUpdateListAction_ReturnsExpectedAction() { - const string actionId = "4f2b972e433e15f21e003fcf"; + const string actionId = "549050b23bcfa906ebb51736"; var actual = (UpdateListAction)_trelloReadOnly.Actions.WithId(actionId); Assert.That(actual.Id, Is.EqualTo(actionId)); - Assert.That(actual.IdMemberCreator, Is.EqualTo(TrellonetTestUser)); - Assert.That(actual.Date, Is.EqualTo(new DateTime(2012, 02, 03, 08, 13, 34, 449))); - Assert.That(actual.Data.Board.Name, Is.EqualTo("Welcome Board")); - Assert.That(actual.Data.Board.Id, Is.EqualTo("4f2b8b4d4f2cb9d16d3684c9")); - Assert.That(actual.Data.List.Name, Is.EqualTo("Basicsx")); - Assert.That(actual.Data.List.Id, Is.EqualTo("4f2b8b4d4f2cb9d16d3684c1")); - Assert.That((string)actual.Data.Old.Value, Is.EqualTo("Basics")); + Assert.That(actual.IdMemberCreator, Is.EqualTo("4f9e6801644163614d59db73")); + Assert.That(actual.Date, Is.EqualTo(new DateTime(2014, 12, 16, 15, 33, 06, 260))); + Assert.That(actual.Data.Board.Name, Is.EqualTo(Constants.TestBoardName)); + Assert.That(actual.Data.Board.Id, Is.EqualTo(Constants.WelcomeBoardId)); + Assert.That(actual.Data.List.Name, Is.EqualTo("Basics")); + Assert.That(actual.Data.List.Id, Is.EqualTo("546f22eea6c3d57a9c63d1b6")); + Assert.That((string)actual.Data.Old.Value, Is.EqualTo("Updated name")); Assert.That(actual.Data.Old.PropertyName, Is.EqualTo("name")); } [Test] public void WithId_AnUpdateCardMoveAction_ReturnsExpectedAction() { - const string actionId = "4f3f58c53374646b5c168e41"; + const string actionId = "54901d9a9ce6202e30717def"; var expected = new UpdateCardMoveAction { Id = actionId, - IdMemberCreator = "4ece5a165237e5db06624a2a", - Date = new DateTime(2012, 02, 18, 07, 52, 37, 780), + IdMemberCreator = "4f9e6801644163614d59db73", + Date = new DateTime(2014, 12, 16, 11, 55, 06, 569), Data = new UpdateCardMoveAction.ActionData { Board = new BoardName { - Id = "4f2b8b4d4f2cb9d16d3684c9", - Name = "Welcome Board" + Id = Constants.WelcomeBoardId, + Name = Constants.TestBoardName, + ShortLink = "UTWsO3Jc" }, Card = new CardName { - Id = "4f2b8b4d4f2cb9d16d3684e6", - Name = "Welcome to Trello!" + Id = "54901d97acb992f4f3c25127", + Name = "This card has moved", + IdShort = 27, + ShortLink = "QQeTBWMy", }, ListBefore = new ListName { - Id = "4f2b8b4d4f2cb9d16d3684c2", - Name = "Intermediate" + Id = "546f22eea6c3d57a9c63d1b6", + Name = "Basics" }, ListAfter = new ListName { - Id = "4f2b8b4d4f2cb9d16d3684c1", - Name = "Basics" + Id = "546f22f06bee6baf018b541d", + Name = "Intermediate" } }, - MemberCreator = CreateActionMemberOskar() + MemberCreator = CreateActionMemberCDW() }.ToExpectedObject(); var actual = _trelloReadOnly.Actions.WithId(actionId); @@ -514,22 +542,22 @@ public void WithId_AnUpdateCardMoveAction_ReturnsExpectedAction() [Test] public void WithId_AnUpdateCardAction_ReturnsExpectedAction() { - const string actionId = "4f2b8b4d4f2cb9d16d368552"; + const string actionId = "549050a3c6ec0e171342e5c5"; var actual = (UpdateCardAction)_trelloReadOnly.Actions.WithId(actionId); Assert.That(actual.Id, Is.EqualTo(actionId)); - Assert.That(actual.IdMemberCreator, Is.EqualTo("4e6a7fad05d98b02ba00845c")); - Assert.That(actual.Date, Is.EqualTo(new DateTime(2012, 01, 09, 19, 35, 17, 719))); - Assert.That(actual.Data.Board.Name, Is.EqualTo("Welcome Board")); - Assert.That(actual.Data.Board.Id, Is.EqualTo("4f2b8b4d4f2cb9d16d3684c9")); - Assert.That(actual.Data.Card.Name, Is.EqualTo("Need help?")); - Assert.That(actual.Data.Card.Id, Is.EqualTo("4f2b8b4d4f2cb9d16d368518")); - Assert.That((string)actual.Data.Old.Value, Is.EqualTo("We got you covered: https://trello.com/help")); - Assert.That(actual.Data.Old.PropertyName, Is.EqualTo("desc")); + Assert.That(actual.IdMemberCreator, Is.EqualTo("4f9e6801644163614d59db73")); + Assert.That(actual.Date, Is.EqualTo(new DateTime(2014, 12, 16, 15, 32, 51, 332))); + Assert.That(actual.Data.Board.Name, Is.EqualTo(Constants.TestBoardName)); + Assert.That(actual.Data.Board.Id, Is.EqualTo("546f22e5cb8013103defe71e")); + Assert.That(actual.Data.Card.Name, Is.EqualTo("Welcome to Trello!")); + Assert.That(actual.Data.Card.Id, Is.EqualTo("5489c83a30bf250d785224b5")); + Assert.That((string)actual.Data.Old.Value, Is.EqualTo("A new name")); + Assert.That(actual.Data.Old.PropertyName, Is.EqualTo("name")); } - [Test] + [Test, Ignore("These events are not creating actions anymore")] public void WithId_AnUpdateOrganizationAction_ReturnsExpectedAction() { const string actionId = "4f79b545f5fd74644c0d4cae"; @@ -548,28 +576,36 @@ public void WithId_AnUpdateOrganizationAction_ReturnsExpectedAction() [Test] public void WithId_AMoveCardToBoardAction_ReturnsExpectedAction() { - const string actionId = "4fb3bd28460a45151c419f2f"; + const string actionId = "54901f357dd09e434f0dcda3"; var expected = new MoveCardToBoardAction { Id = actionId, - IdMemberCreator = "4f2b8b464f2cb9d16d368326", - Date = new DateTime(2012, 05, 16, 14, 43, 52, 668), + IdMemberCreator = "4f9e6801644163614d59db73", + Date = new DateTime(2014, 12, 16, 12, 01, 57, 964), Data = new MoveCardToBoardAction.ActionData { - BoardSource = new BoardId("4f3f548a57189443042c49e1"), + BoardSource = new BoardId("546f22e5cb8013103defe71e"), Board = new BoardName { Name = "Welcome Board", - Id = "4f2b8b4d4f2cb9d16d3684c9" + Id = "4f9e6802644163614d59db7f", + ShortLink = "vsP00mMP" }, Card = new CardName { - Name = "To learn more tricks, check out the guide.", - Id = "4f2b8b4d4f2cb9d16d368506" + Name = "This card has moved board", + Id = "54901f1c8e296a00309e4141", + IdShort = 20, + ShortLink = "k4xxhAwj" + }, + List = new ListName + { + Name = "Advanced", + Id = "4f9e6802644163614d59db87" } - }, - MemberCreator = CreateActionMemberMe() + }, + MemberCreator = CreateActionMemberCDW() }.ToExpectedObject(); var actual = _trelloReadOnly.Actions.WithId(actionId); @@ -580,28 +616,29 @@ public void WithId_AMoveCardToBoardAction_ReturnsExpectedAction() [Test] public void WithId_AMoveCardFromBoardAction_ReturnsExpectedAction() { - const string actionId = "4fb3bd0553cd2e1031085484"; + const string actionId = "54901f357dd09e434f0dcda2"; var expected = new MoveCardFromBoardAction { Id = actionId, - IdMemberCreator = "4f2b8b464f2cb9d16d368326", - Date = new DateTime(2012, 05, 16, 14, 43, 17, 085), + IdMemberCreator = "4f9e6801644163614d59db73", + Date = new DateTime(2014, 12, 16, 12, 01, 57, 963), Data = new MoveCardFromBoardAction.ActionData { - BoardTarget = new BoardId("4f3f548a57189443042c49e1"), + BoardTarget = new BoardId("4f9e6802644163614d59db7f"), Board = new BoardName { - Name = "Welcome Board", - Id = "4f2b8b4d4f2cb9d16d3684c9" + Name = Constants.TestBoardName, + Id = Constants.WelcomeBoardId, + ShortLink = "UTWsO3Jc" }, Card = new CardName { - Name = "To learn more tricks, check out the guide.", - Id = "4f2b8b4d4f2cb9d16d368506" + Name = "This card has moved board", + Id = "54901f1c8e296a00309e4141" } }, - MemberCreator = CreateActionMemberMe() + MemberCreator = CreateActionMemberCDW() }.ToExpectedObject(); var actual = _trelloReadOnly.Actions.WithId(actionId); @@ -612,42 +649,41 @@ public void WithId_AMoveCardFromBoardAction_ReturnsExpectedAction() [Test] public void WithId_ConvertToCardFromCheckItemAction_ReturnsExpectedAction() { - const string actionId = "4fb9dc4bd36927891c56115a"; + const string actionId = "54906660432f718207a69caa"; var expected = new ConvertToCardFromCheckItemAction { Id = actionId, - IdMemberCreator = "4f2b8b464f2cb9d16d368326", - Date = new DateTime(2012, 05, 21, 06, 10, 19, 030), + IdMemberCreator = "4f9e6801644163614d59db73", + Date = new DateTime(2014, 12, 16, 17, 05, 36, 471), Data = new ConvertToCardFromCheckItemAction.ActionData { CardSource = new CardName { - Id = "4f2b8b4d4f2cb9d16d368518", - Name = "Need help?" + Id = "5490661c5165d3c9cdcf2e83", + Name = "Testing membership", + ShortLink = "rTIw2Z1E", + IdShort = 45 }, Card = new CardName { - Id = "4fb9dc4ad36927891c56107a", - Name = "Testing stuff" - }, - Checklist = new ChecklistName - { - Id = "4fb9dc40d36927891c560dba", - Name = "Checklist" + Id = "54906660432f718207a69ca9", + Name = "Convert this item to a card", + IdShort = 46 }, Board = new BoardName { - Id = "4f2b8b4d4f2cb9d16d3684c9", - Name = "Welcome Board" + Id = "546f22e5cb8013103defe71e", + Name = Constants.TestBoardName, + ShortLink = "UTWsO3Jc" }, - CheckItem = new CheckItemName + List = new ListName { - Id = "4fb9dc46d36927891c560f42", - Name = "Testing stuff" + Id = "5489c9541410d7d4cf8622a2", + Name = "Advanced" } - }, - MemberCreator = CreateActionMemberMe() + }, + MemberCreator = CreateActionMemberCDW() }.ToExpectedObject(); var actual = _trelloReadOnly.Actions.WithId(actionId); @@ -658,39 +694,33 @@ public void WithId_ConvertToCardFromCheckItemAction_ReturnsExpectedAction() [Test] public void WithId_DeleteCardAction_ReturnsExpectedAction() { - const string actionId = "5212fb1e533cf7af13000a17"; + const string actionId = "54905dc1db0fa4f6f37fca72"; var expected = new DeleteCardAction { Id = actionId, - IdMemberCreator = "4f41e47ff77233e905b22bd6", - Date = new DateTime(2013, 08, 20, 05, 14, 06, 198), + IdMemberCreator = "4f9e6801644163614d59db73", + Date = new DateTime(2014, 12, 16, 16, 28, 49, 650), Data = new DeleteCardAction.ActionData { List = new ListName { - Id = "4f41e4803374646b5c74bd61", + Id = "546f22eea6c3d57a9c63d1b6", Name = "Basics" }, Card = new CardName { - IdShort = 302, - Id = "5212fb1d3d30dea523001437", + IdShort = 44, + Id = "54905dbf2770886a88190785", Name = null }, Board = new BoardName { - Id = "4f41e4803374646b5c74bd69", - Name = "Welcome Board" + Id = "546f22e5cb8013103defe71e", + Name = Constants.TestBoardName, + ShortLink = "UTWsO3Jc" }, }, - MemberCreator = new Action.ActionMember - { - FullName = "Trello Net", - Username = "usernet", - Id = "4f41e47ff77233e905b22bd6", - AvatarHash = null, - Initials = "TN" - } + MemberCreator = CreateActionMemberCDW() }.ToExpectedObject(); @@ -703,38 +733,31 @@ public void WithId_DeleteCardAction_ReturnsExpectedAction() [Test] public void WithId_CloseCardAction_ReturnsExpectedAction() { - const string actionId = "5285c53f7bc0f5b8470085da"; + const string actionId = "549066c5cde2c78335813daa"; var expected = new CloseCardAction() { Id = actionId, - IdMemberCreator = "4f41e47ff77233e905b22bd6", - Date = new DateTime(2013, 11, 15, 06, 54, 55, 763), + IdMemberCreator = "4f9e6801644163614d59db73", + Date = new DateTime(2014, 12, 16, 17, 07, 17, 326), Data = new CloseCardAction.ActionData { Card = new CloseCardAction.CardName { - IdShort = 1, - ShortLink = "gPMJlZNf", - Id = "4f41e4803374646b5c74bdb0", - Name = "Welcome to Trello!", - Closed = false + IdShort = 47, + ShortLink = "8JomUKyL", + Id = "549066bea79849355dc793c8", + Name = "This card will be closed", + Closed = true }, Board = new BoardName { - Id = "4f41e4803374646b5c74bd69", - Name = "Welcome Board", - ShortLink = "jugcBbEa" + Id = Constants.WelcomeBoardId, + Name = Constants.TestBoardName, + ShortLink = "UTWsO3Jc" }, Old = new Old () }, - MemberCreator = new Action.ActionMember - { - FullName = "Trello Net", - Username = "usernet", - Id = "4f41e47ff77233e905b22bd6", - AvatarHash = null, - Initials = "TN" - } + MemberCreator = CreateActionMemberCDW() }.ToExpectedObject(); @@ -746,42 +769,35 @@ public void WithId_CloseCardAction_ReturnsExpectedAction() [Test] - public void WithId_ChangePositiondAction_ReturnsExpectedAction() + public void WithId_ChangePositionAction_ReturnsExpectedAction() { - const string actionId = "5286491744bea3b55c00b33a"; - var expected = new UpdateCardPositionAction() - { - Id = actionId, - IdMemberCreator = "4f41e47ff77233e905b22bd6", - Date = new DateTime(2013, 11, 15, 16, 17, 27, 874), - Data = new UpdateCardPositionAction.ActionData - { - Card = new UpdateCardPositionAction.CardName - { - IdShort = 15, - ShortLink = "LE15KVKv", - Id = "4f41e4803374646b5c74bd9b", - Name = "Want to use keyboard shortcuts? We have them!", - Pos = 196608 - }, - Board = new BoardName - { - Id = "4f41e4803374646b5c74bd69", - Name = "Welcome Board", - ShortLink = "jugcBbEa" - }, - Old = new Old () - }, - MemberCreator = new Action.ActionMember - { - FullName = "Trello Net", - Username = "usernet", - Id = "4f41e47ff77233e905b22bd6", - AvatarHash = null, - Initials = "TN" - } + const string actionId = "5492e001db393d0dea45fb0f"; + var expected = new UpdateCardPositionAction() + { + Id = actionId, + IdMemberCreator = "4f9e6801644163614d59db73", + Date = new DateTime(2014, 12, 18, 14, 09, 05, 695), + Data = new UpdateCardPositionAction.ActionData + { + Card = new UpdateCardPositionAction.CardName + { + IdShort = 46, + ShortLink = "yFzlMyML", + Id = "54906660432f718207a69ca9", + Name = "Convert this item to a card", + Pos = 16383.75 + }, + Board = new BoardName + { + Id = Constants.WelcomeBoardId, + Name = Constants.TestBoardName, + ShortLink = "UTWsO3Jc" + }, + Old = new Old() + }, + MemberCreator = CreateActionMemberCDW() - }.ToExpectedObject(); + }.ToExpectedObject(); var result = _trelloReadWrite.Actions.WithId(actionId); @@ -850,7 +866,7 @@ public void ForCard_TheWelcomeCardWithPaging3_Returns3Actions() [Test] public void ForList_ATestList_Returns1Action() { - var actions = _trelloReadOnly.Actions.ForList(new ListId("4f6e4fca255ed1e908575821"), paging: new Paging(1, 0)); + var actions = _trelloReadOnly.Actions.ForList(new ListId(Constants.WelcomeBoardBasicsListId), paging: new Paging(1, 0)); Assert.That(actions.Count(), Is.EqualTo(1)); } @@ -874,9 +890,9 @@ public void ForMe_WithPaging10_Returns10Actions() [Test] public void ForList_ATestList_Returns1ActionWithMemberCreator() { - var expected = CreateActionMemberMe(); + var expected = CreateActionMemberCDW(); - var actions = _trelloReadOnly.Actions.ForList(new ListId("4f6e4fca255ed1e908575821"), paging: new Paging(1, 0)); + var actions = _trelloReadOnly.Actions.ForList(new ListId(Constants.WelcomeBoardBasicsListId), paging: new Paging(1, 0)); expected.ToExpectedObject().ShouldMatch(actions.First().MemberCreator); } @@ -947,7 +963,7 @@ public void Scenario_AddAndDeleteComment() public void ChangeText_ActionIdDoesNotExist_Throws() { Assert.That(() => _trelloReadWrite.Actions.ChangeText(GetDummyActionWithInvalidId(), "some text"), - Throws.InstanceOf().With.Matches(e => e.Message == "invalid id\n")); + Throws.InstanceOf().With.Matches(e => e.Message == "invalid id")); } [TestCase("")] @@ -969,7 +985,7 @@ public void ChangeText_NewTextIsTooLong_Throws() public void Delete_ActionIdIsInvalid_Throws() { Assert.That(() => _trelloReadWrite.Actions.ChangeText(GetDummyActionWithInvalidId(), "some text"), - Throws.InstanceOf().With.Matches(e => e.Message == "invalid id\n")); + Throws.InstanceOf().With.Matches(e => e.Message == "invalid id")); } [Test] @@ -977,7 +993,7 @@ public void Bug_Issue33_MissingActions() { // Create a card with a checklist and a checkitem var card = _trelloReadWrite.Cards.Add("Bug_Issue33 card", new ListId(Constants.WritableListId)); - var checkList = _trelloReadWrite.Checklists.Add("Bug_Issue33 checklist", new BoardId(card.IdBoard)); + var checkList = _trelloReadWrite.Checklists.Add("Bug_Issue33 checklist", new CardId(card.Id)); _trelloReadWrite.Cards.AddChecklist(card, checkList); _trelloReadWrite.Checklists.AddCheckItem(checkList, "Bug_Issue33 check item"); // TODO: Does this not return a check item id? @@ -1006,8 +1022,10 @@ private static CardName TheWelcomeCard() { return new CardName { - Id = "4f2b8b4d4f2cb9d16d3684e6", - Name = "Welcome to Trello!" + Id = Constants.WelcomeCardOfTheWelcomeBoardId, + Name = Constants.TestCardName1, + IdShort = 1, + ShortLink = "21UnMVtO" }; } @@ -1015,8 +1033,9 @@ private static BoardName TheWelcomeBoard() { return new BoardName { - Id = "4f2b8b4d4f2cb9d16d3684c9", - Name = "Welcome Board" + Id = Constants.WelcomeBoardId, + Name = Constants.TestBoardName, + ShortLink = "UTWsO3Jc" }; } @@ -1024,8 +1043,10 @@ private static CardName TheLearnTricksCard() { return new CardName { - Id = "4f2b8b4d4f2cb9d16d368506", - Name = "To learn more tricks, check out the guide." + Id = Constants.TestCardId2, + Name = Constants.TestCardName2, + IdShort = 2, + ShortLink = "SyBfTUYS" }; } @@ -1053,6 +1074,18 @@ private static Action.ActionMember CreateActionMemberOskar() }; } + private static Action.ActionMember CreateActionMemberCDW() + { + return new Action.ActionMember + { + FullName = "Christopher Downes-Ward", + Username = "christopherdownesward", + Id = "4f9e6801644163614d59db73", + AvatarHash = "5db13c831c6f50ac6e97217bc77f4034", + Initials = "CDW" + }; + } + private static Action.ActionMember CreateActionMemberTrello() { return new Action.ActionMember diff --git a/TrelloNet.Tests/App.config b/TrelloNet.Tests/App.config index fb7d367..f994ddf 100644 --- a/TrelloNet.Tests/App.config +++ b/TrelloNet.Tests/App.config @@ -1,8 +1,8 @@  - - - + + + \ No newline at end of file diff --git a/TrelloNet.Tests/BoardTests.cs b/TrelloNet.Tests/BoardTests.cs index bfdbf93..79f8cb3 100644 --- a/TrelloNet.Tests/BoardTests.cs +++ b/TrelloNet.Tests/BoardTests.cs @@ -9,7 +9,7 @@ namespace TrelloNet.Tests [TestFixture] public class BoardTests : TrelloTestBase { - private readonly IBoardId _welcomeBoardWritable = new BoardId("4f41e4803374646b5c74bd69"); + private readonly IBoardId _welcomeBoardWritable = new BoardId(Constants.WelcomeBoardId); [Test] public void WithId_TheWelcomeBoard_ReturnsExpectedWelcomeBoard() @@ -59,7 +59,7 @@ public void ForMember_Me_ReturnsTheWelcomeBoard() { var boards = _trelloReadOnly.Boards.ForMember(new Me()); - Assert.That(boards, Has.Some.Matches(b => b.Name == "Welcome Board")); + Assert.That(boards, Has.Some.Matches(b => b.Name == Constants.TestBoardName)); } [Test] @@ -67,7 +67,7 @@ public void ForMe_Always_ReturnsTheWelcomeBoard() { var boards = _trelloReadOnly.Boards.ForMe(); - Assert.That(boards, Has.Some.Matches(b => b.Name == "Welcome Board")); + Assert.That(boards, Has.Some.Matches(b => b.Name == Constants.TestBoardName)); } [Test] @@ -86,8 +86,9 @@ public void ForMember_MeAndClosed_ReturnsTheClosedBoard() { var boards = _trelloReadOnly.Boards.ForMember(new Me(), BoardFilter.Closed); - Assert.That(boards, Has.Count.EqualTo(2)); - Assert.That(boards, Has.Some.Matches(b => b.Name == "A closed board")); + // I have multiple boards and regularly close them... + Assert.That(boards, Has.Count.GreaterThan(2)); + Assert.That(boards, Has.Some.Matches(b => b.Name == "Trello.NET Test Board")); } [Test] @@ -120,7 +121,7 @@ public void ForChecklist_TheChecklistInTheLastCardOfTheBasicsList_ReturnsTheWelc { var expectedBoard = CreateExpectedWelcomeBoard(); - var board = _trelloReadOnly.Boards.ForChecklist(new ChecklistId("4f2b8b4d4f2cb9d16d3684c7")); + var board = _trelloReadOnly.Boards.ForChecklist(new ChecklistId(Constants.ChecklistId)); expectedBoard.ShouldMatch(board); Assert.That(board.LabelNames, Is.EquivalentTo(CreateExpectedWelcomeBoardLabels())); @@ -158,9 +159,14 @@ public void ForOrganization_TestOrganization_ReturnsTheWelcomeBoard() var boards = _trelloReadOnly.Boards.ForOrganization(new OrganizationId(Constants.TestOrganizationId)); - Assert.That(boards.Count(), Is.EqualTo(1)); - expectedBoard.ShouldMatch(boards.First()); - Assert.That(boards.First().LabelNames, Is.EquivalentTo(CreateExpectedWelcomeBoardLabels())); + Assert.That(boards.Count(), Is.EqualTo(3)); + foreach(var b in boards) { + if (b.Name.StartsWith("Trello")) + { + expectedBoard.ShouldMatch(b); + Assert.That(b.LabelNames, Is.EquivalentTo(CreateExpectedWelcomeBoardLabels())); + } + } } [Test] @@ -168,7 +174,7 @@ public void ForOrganization_TestOrganizationAndClosed_ReturnsNoBoards() { var boards = _trelloReadOnly.Boards.ForOrganization(new OrganizationId(Constants.TestOrganizationId), BoardFilter.Closed); - Assert.That(boards.Count(), Is.EqualTo(0)); + Assert.That(boards.Count(), Is.EqualTo(1)); } [Test] @@ -185,7 +191,6 @@ public void Scenario_AddAndClose() Assert.That(newBoard, Is.Not.Null); Assert.That(newBoard.Name, Is.EqualTo("A new board")); - Assert.That(newBoard.Desc, Is.EqualTo("the description")); _trelloReadWrite.Boards.Close(newBoard); @@ -218,43 +223,28 @@ public void Scenario_ChangeName() Assert.That(boardwithChangedName.Name, Is.EqualTo("A new name")); - _trelloReadWrite.Boards.ChangeName(_welcomeBoardWritable, "Welcome Board"); - } - - [Test] - public void Scenario_ChangeDescription() - { - _trelloReadWrite.Boards.ChangeDescription(_welcomeBoardWritable, "A new description"); - - var boardwithChangedDescription = _trelloReadWrite.Boards.WithId(_welcomeBoardWritable.GetBoardId()); - - Assert.That(boardwithChangedDescription.Desc, Is.EqualTo("A new description")); - - _trelloReadWrite.Boards.ChangeDescription(_welcomeBoardWritable, ""); + _trelloReadWrite.Boards.ChangeName(_welcomeBoardWritable, Constants.TestBoardName); } [Test] public void Scenario_UpdateNameDescriptionAndClosed() { - var board = _trelloReadWrite.Boards.WithId("4f41e4803374646b5c74bd69"); + var board = _trelloReadWrite.Boards.WithId(Constants.AClosedBoardId); board.Name = "Updated name"; - board.Desc = "Updated description"; - board.Closed = true; + board.Closed = false; _trelloReadWrite.Boards.Update(board); var boardAfterUpdate = _trelloReadWrite.Boards.WithId(board.Id); - board.Name = "Welcome Board"; - board.Desc = ""; - board.Closed = false; + board.Name = Constants.TestBoardName; + board.Closed = true; _trelloReadWrite.Boards.Update(board); Assert.That(boardAfterUpdate.Name, Is.EqualTo("Updated name")); - Assert.That(boardAfterUpdate.Desc, Is.EqualTo("Updated description")); - Assert.That(boardAfterUpdate.Closed, Is.EqualTo(true)); + Assert.That(boardAfterUpdate.Closed, Is.EqualTo(false)); } [Test] @@ -270,7 +260,7 @@ public void Scenario_ChangePermissionLevel() [Test] public void Scenario_AddAndRemoveMember() { - var member = new MemberId(Constants.MeId); + var member = new MemberId(Constants.DevelopmentId); _trelloReadWrite.Boards.AddMember(_welcomeBoardWritable, member); var membersAfterAddMember = _trelloReadWrite.Members.ForBoard(_welcomeBoardWritable); @@ -278,20 +268,20 @@ public void Scenario_AddAndRemoveMember() _trelloReadWrite.Boards.RemoveMember(_welcomeBoardWritable, member); var membersAfterRemoveMember = _trelloReadWrite.Members.ForBoard(_welcomeBoardWritable); - Assert.That(membersAfterAddMember.Any(x => x.Id.Equals(Constants.MeId))); - Assert.That(!membersAfterRemoveMember.Any(x => x.Id.Equals(Constants.MeId))); + Assert.That(membersAfterAddMember.Any(x => x.Id.Equals(Constants.DevelopmentId))); + Assert.That(!membersAfterRemoveMember.Any(x => x.Id.Equals(Constants.DevelopmentId))); } [Test] public void Scenario_ChangeLabelName() { var board = _welcomeBoardWritable; - _trelloReadWrite.Boards.ChangeLabelName(board, Color.Red, "Bug"); + _trelloReadWrite.Boards.ChangeLabelName(board, "red", "Bug"); var boardAfterChange = _trelloReadWrite.Boards.WithId(board.GetBoardId()); - _trelloReadWrite.Boards.ChangeLabelName(board, Color.Red, null); + _trelloReadWrite.Boards.ChangeLabelName(board, "red", null); - Assert.That(boardAfterChange.LabelNames[Color.Red], Is.EqualTo("Bug")); + Assert.That(boardAfterChange.LabelNames["red"], Is.EqualTo("Bug")); } [Test] @@ -369,11 +359,11 @@ private static ExpectedObject CreateExpectedWelcomeBoard() return new { Closed = false, - Name = "Welcome Board", - Desc = "A test description", + Name = Constants.TestBoardName, IdOrganization = Constants.TestOrganizationId, - Pinned = true, - Url = "https://trello.com/b/J9JUdoYV/welcome-board", + Pinned = false, + Starred = true, + Url = "https://trello.com/b/UTWsO3Jc/trello-net-test-board", Id = Constants.WelcomeBoardId, Prefs = new BoardPreferences { @@ -385,17 +375,38 @@ private static ExpectedObject CreateExpectedWelcomeBoard() }.ToExpectedObject(); } - private static Dictionary CreateExpectedWelcomeBoardLabels() + private static Dictionary CreateExpectedWelcomeBoardLabels() { - return new Dictionary + return new Dictionary { - { Color.Yellow, "" }, - { Color.Red, "" }, - { Color.Purple, "" }, - { Color.Orange, "" }, - { Color.Green, "label name" }, - { Color.Blue, "" }, + { "yellow", "I am yellow" }, + { "red", "Bug" }, + { "purple", "I am purple" }, + { "orange", "I am amber" }, + { "green", "I am green" }, + { "blue", "I am blue" }, + { "sky", "" }, + { "lime", "" }, + { "pink", "" }, + { "black", "" } }; } + + private static Dictionary CreateExpectedWelcomeBoardLabelsWithNoNames() + { + return new Dictionary + { + { "yellow", "" }, + { "red", "" }, + { "purple", "" }, + { "orange", "" }, + { "green", "" }, + { "blue", "" }, + { "sky", "" }, + { "lime", "" }, + { "pink", "" }, + { "black", "" } + }; + } } } \ No newline at end of file diff --git a/TrelloNet.Tests/CardTests.cs b/TrelloNet.Tests/CardTests.cs index 842c853..a6b2d80 100644 --- a/TrelloNet.Tests/CardTests.cs +++ b/TrelloNet.Tests/CardTests.cs @@ -11,19 +11,20 @@ namespace TrelloNet.Tests [TestFixture] public class CardTests : TrelloTestBase { - private readonly ICardId _welcomeToTrelloCardWritable = new CardId("4f41e4803374646b5c74bdb0"); - private readonly IBoardId _welcomeBoardWritable = new BoardId("4f41e4803374646b5c74bd69"); + private readonly ICardId _welcomeToTrelloCardWritable = new CardId(Constants.TestCardId2); + private readonly IBoardId _welcomeBoardWritable = new BoardId(Constants.WelcomeBoardId); private readonly IListId _basicsListWritable = new ListId(Constants.WritableListId); - private readonly IListId _intermediateListWritable = new ListId("4f41e4803374646b5c74bd62"); - private readonly IMemberId _memberTrello = new MemberId("4e6a7fad05d98b02ba00845c"); - private const string CardWithCheckList = "4f41e4803374646b5c74bdbe"; + private readonly IListId _intermediateListWritable = new ListId("546f22f06bee6baf018b541d"); + private readonly IMemberId _memberTrello = new MemberId("4f9e6801644163614d59db73"); + private const string CardWithCheckList = "5489c83a30bf250d785224b5"; + private const string AnotherCardWithAList = "567a604fa68e80b6fa55e4fa"; [Test] public void WithId_WelcomeCardOfTheWelcomeBoard_ReturnsTheWelcomeCard() { - var expectedCard = CreateExpectedWelcomeCard(); + var expectedCard = CreateExpectedTestCard1(); - var actualCard = _trelloReadOnly.Cards.WithId(Constants.WelcomeCardOfTheWelcomeBoardId); + var actualCard = _trelloReadOnly.Cards.WithId("5493f3704c334c6ae943a966"); expectedCard.ShouldEqual(actualCard); } @@ -31,7 +32,7 @@ public void WithId_WelcomeCardOfTheWelcomeBoard_ReturnsTheWelcomeCard() [Test] public void WithId_ANonLabeledCard_ReturnsEmptyList() { - var card = _trelloReadOnly.Cards.WithId("4f2b8b4d4f2cb9d16d3684e6"); + var card = _trelloReadOnly.Cards.WithId("549436a7c3b50ac48e069113"); Assert.That(card.Labels, Is.Not.Null); Assert.That(card.Labels, Is.Empty); @@ -42,11 +43,11 @@ public void WithId_TheOnlyLabeledCard_ContainsTwoLabels() { var expectedLabels = new List { - new Card.Label { Color = Color.Green, Name = "label name" }, - new Card.Label { Color = Color.Red, Name = "" } + new Card.Label { Color = "green", Name = "I am green" }, + new Card.Label { Color = "purple", Name = "I am purple" } }.ToExpectedObject(); - var card = _trelloReadOnly.Cards.WithId("4f2b8b4d4f2cb9d16d36851b"); + var card = _trelloReadOnly.Cards.WithId("549436dcbf052c0a341dcf06"); expectedLabels.ShouldEqual(card.Labels); } @@ -54,7 +55,7 @@ public void WithId_TheOnlyLabeledCard_ContainsTwoLabels() [Test] public void WithId_CardWithCheckList_HasOneCheckList() { - var card = _trelloReadWrite.Cards.WithId(CardWithCheckList); + var card = _trelloReadWrite.Cards.WithId(AnotherCardWithAList); Assert.That(card.Checklists.Count(), Is.EqualTo(1)); } @@ -62,7 +63,7 @@ public void WithId_CardWithCheckList_HasOneCheckList() [Test] public void WithId_CardWithCheckList_HasChecklistWithThreeItemsAndtheFirstItemIsChecked() { - var card = _trelloReadWrite.Cards.WithId(CardWithCheckList); + var card = _trelloReadWrite.Cards.WithId(AnotherCardWithAList); Assert.That(card.Checklists.First().CheckItems.Count, Is.EqualTo(3)); Assert.That(card.Checklists.First().CheckItems.ElementAt(0).Checked, Is.EqualTo(true)); @@ -78,19 +79,19 @@ public void WithId_Null_Throws() } [Test] - public void ForList_WelcomeBoardBasicsList_ReturnsSixCards() + public void ForList_WelcomeBoardBasicsList_ReturnsTenCards() { var cards = _trelloReadOnly.Cards.ForList(new ListId(Constants.WelcomeBoardBasicsListId)); - Assert.That(cards.Count(), Is.EqualTo(6)); + Assert.That(cards.Count(), Is.EqualTo(10)); } [Test] public void ForList_WelcomeBoardBasicsList_AllFieldsOfCardAreMapped() { - var expectedCard = CreateExpectedWelcomeCard(); + var expectedCard = CreateExpectedTestCard2(); - var card = _trelloReadOnly.Cards.ForList(new ListId(Constants.WelcomeBoardBasicsListId)).Single(c => c.Id == Constants.WelcomeCardOfTheWelcomeBoardId); + var card = _trelloReadOnly.Cards.ForList(new ListId(Constants.WelcomeBoardBasicsListId)).Single(c => c.Id == "54942eca7718c5a8c7d1fbd0"); expectedCard.ShouldEqual(card); } @@ -115,7 +116,7 @@ public void ForMember_Me_ReturnsTheWelcomeCardOnly() { var cards = _trelloReadOnly.Cards.ForMember(new Me()); - Assert.That(cards.Count(), Is.EqualTo(1)); + Assert.That(cards.Count(), Is.AtLeast(1)); Assert.That(cards, Has.Some.Matches(c => c.Name == "Welcome to Trello!")); } @@ -124,16 +125,17 @@ public void ForMe_Always_ReturnsTheWelcomeCardOnly() { var cards = _trelloReadOnly.Cards.ForMe(); - Assert.That(cards.Count(), Is.EqualTo(1)); + // I do real work and am on many cards + Assert.That(cards.Count(), Is.AtLeast(1)); Assert.That(cards, Has.Some.Matches(c => c.Name == "Welcome to Trello!")); } [Test] public void ForMember_Me_AllFieldsOfCardAreMapped() { - var expectedCard = CreateExpectedWelcomeCard(); + var expectedCard = CreateExpectedTestCard1(); - var actualCard = _trelloReadOnly.Cards.ForMember(new Me()).Single(m => m.Id == Constants.WelcomeCardOfTheWelcomeBoardId); + var actualCard = _trelloReadOnly.Cards.ForMember(new Me()).Single(m => m.Id == "5493f3704c334c6ae943a966"); expectedCard.ShouldEqual(actualCard); } @@ -143,8 +145,9 @@ public void ForMember_MeAndClosed_ReturnsTheArchivedCardOnly() { var cards = _trelloReadOnly.Cards.ForMember(new Me(), CardFilter.Closed); - Assert.That(cards.Count(), Is.EqualTo(1)); - Assert.That(cards, Has.Some.Matches(c => c.Name == "An archived card")); + // I do real work and am on many cards + Assert.That(cards.Count(), Is.AtLeast(1)); + Assert.That(cards, Has.Some.Matches(c => c.Name == "This card is closed")); } [Test] @@ -155,29 +158,29 @@ public void ForMember_Null_Throws() } [Test] - public void ForBoard_WelcomeBoard_Returns18Cards() + public void ForBoard_WelcomeBoard_Returns23Cards() { var cards = _trelloReadOnly.Cards.ForBoard(new BoardId(Constants.WelcomeBoardId)); - Assert.That(cards.Count(), Is.EqualTo(18)); + Assert.That(cards.Count(), Is.EqualTo(23)); } [Test] public void ForBoard_WelcomeBoard_AllFieldsOfCardSAreMapped() { - var expectedCard = CreateExpectedWelcomeCard(); + var expectedCard = CreateExpectedTestCard1(); - var card = _trelloReadOnly.Cards.ForBoard(new BoardId(Constants.WelcomeBoardId)).Single(c => c.Id == Constants.WelcomeCardOfTheWelcomeBoardId); + var card = _trelloReadOnly.Cards.ForBoard(new BoardId(Constants.WelcomeBoardId)).Single(c => c.Id == "5493f3704c334c6ae943a966"); expectedCard.ShouldEqual(card); } [Test] - public void ForBoard_WelcomeBoardAndClosed_Returns1Card() + public void ForBoard_WelcomeBoardAndClosed_Returns2Cards() { var cards = _trelloReadOnly.Cards.ForBoard(new BoardId(Constants.WelcomeBoardId), BoardCardFilter.Closed); - Assert.That(cards.Count(), Is.EqualTo(1)); + Assert.That(cards.Count(), Is.EqualTo(2)); } [Test] @@ -190,10 +193,10 @@ public void ForBoard_Null_Throws() [Test] public void ForChecklist_TheChecklistInTheLastCardOfTheBasicsList_ReturnsItsCard() { - var card = _trelloReadOnly.Cards.ForChecklist(new ChecklistId("4f2b8b4d4f2cb9d16d3684c7")); + var card = _trelloReadOnly.Cards.ForChecklist(new ChecklistId("5489c8f481bb7d5b780be290")); Assert.That(card.Count(), Is.EqualTo(1)); - Assert.That(card.First().Name, Is.EqualTo("... or checklists.")); + Assert.That(card.First().Name, Is.EqualTo("A third test card")); } [Test] @@ -206,9 +209,9 @@ public void ForChecklist_Null_Throws() [Test] public void WithShortId_TheWelcomeCard_ReturnsTheWelcomeCard() { - var expected = CreateExpectedWelcomeCard(); + var expected = CreateExpectedTestCard1(); - var actual = _trelloReadOnly.Cards.WithShortId(1, new BoardId(Constants.WelcomeBoardId)); + var actual = _trelloReadOnly.Cards.WithShortId(82, new BoardId(Constants.WelcomeBoardId)); expected.ShouldEqual(actual); } @@ -218,7 +221,7 @@ public void Scenario_ChangeDueDate() { _trelloReadWrite.Cards.ChangeDueDate(_welcomeToTrelloCardWritable, new DateTime(2015, 01, 01, 0, 0, 0, DateTimeKind.Utc)); - var cardAfterChange = GetWelcomeToTrelloCard(); + var cardAfterChange = GetTrelloCard(Constants.TestCardId2); Assert.That(cardAfterChange.Due, Is.EqualTo(new DateTime(2015, 01, 01, 0, 0, 0, DateTimeKind.Utc))); @@ -231,13 +234,15 @@ public void ChangeDueDate_BugIncorrectSerializationOfDatesForCertainCultures() var cultureBefore = Thread.CurrentThread.CurrentCulture; Thread.CurrentThread.CurrentCulture = new CultureInfo("nl-BE"); - _trelloReadWrite.Cards.ChangeDueDate(_welcomeToTrelloCardWritable, new DateTime(2012, 03, 09, 0, 0, 0, DateTimeKind.Utc)); + string cardId = "5493ebd2632698c138ae670d"; + + _trelloReadWrite.Cards.ChangeDueDate(new CardId(cardId), new DateTime(2015, 03, 09, 0, 0, 0, DateTimeKind.Utc)); Thread.CurrentThread.CurrentCulture = cultureBefore; - var cardAfterChange = GetWelcomeToTrelloCard(); + var cardAfterChange = GetTrelloCard(cardId); - Assert.That(cardAfterChange.Due, Is.EqualTo(new DateTime(2012, 03, 09, 0, 0, 0, DateTimeKind.Utc))); + Assert.That(cardAfterChange.Due, Is.EqualTo(new DateTime(2015, 03, 09, 0, 0, 0, DateTimeKind.Utc))); } [Test] @@ -325,9 +330,9 @@ public void Scenario_MoveCardBetweenLists() [Test] public void Scenario_MoveCardBetweenBoards() { - const string cardToMoveId = "4f41e4803374646b5c74bdbe"; - const string targetBoardId = "5073b5f818b001167c191bf4"; - const string targetListId = "5073b5f818b001167c191bf6"; + const string cardToMoveId = "4f9e6803644163614d59dbd1"; + const string targetBoardId = "546f22e5cb8013103defe71e"; + const string targetListId = "5494345ee655a2d2380bdc69"; _trelloReadWrite.Cards.Move(new CardId(cardToMoveId), new BoardId(targetBoardId), new ListId(targetListId)); @@ -344,39 +349,40 @@ public void Scenario_AddAndRemoveLabel() { var card = GetWelcomeToTrelloCard(); - Assert.That(card.Labels.All(l => l.Color != Color.Purple)); + Assert.That(card.Labels.All(l => l.Color != "purple")); - _trelloReadWrite.Cards.AddLabel(card, Color.Purple); + _trelloReadWrite.Cards.AddLabel(card, "purple"); var cardAfterLabelAdded = _trelloReadWrite.Cards.WithId(card.Id); - Assert.That(cardAfterLabelAdded.Labels.Any(l => l.Color == Color.Purple)); + Assert.That(cardAfterLabelAdded.Labels.Any(l => l.Color == "purple")); - _trelloReadWrite.Cards.RemoveLabel(card, Color.Purple); + _trelloReadWrite.Cards.RemoveLabel(card, "purple"); var cardAfterLabelRemoved = _trelloReadWrite.Cards.WithId(card.Id); - Assert.That(cardAfterLabelRemoved.Labels.All(l => l.Color != Color.Purple)); + Assert.That(cardAfterLabelRemoved.Labels.All(l => l.Color != "purple")); } [Test] public void Scenario_AddAndRemoveMember() - { - var membersForCard = _trelloReadWrite.Members.ForCard(_welcomeToTrelloCardWritable); + { + var cardId = new CardId("54943530a351e75fc7dc9365"); + var membersForCard = _trelloReadWrite.Members.ForCard(cardId); - Assert.That(membersForCard.All(m => m.Username != "trello")); + Assert.That(membersForCard.All(m => m.Username != "christopherdownesward")); - _trelloReadWrite.Cards.AddMember(_welcomeToTrelloCardWritable, _memberTrello); + _trelloReadWrite.Cards.AddMember(cardId, _memberTrello); - var membersForCardAfterAdd = _trelloReadWrite.Members.ForCard(_welcomeToTrelloCardWritable); + var membersForCardAfterAdd = _trelloReadWrite.Members.ForCard(cardId); - Assert.That(membersForCardAfterAdd.Any(m => m.Username == "trello")); + Assert.That(membersForCardAfterAdd.Any(m => m.Username == "christopherdownesward")); - _trelloReadWrite.Cards.RemoveMember(_welcomeToTrelloCardWritable, _memberTrello); + _trelloReadWrite.Cards.RemoveMember(cardId, _memberTrello); - var membersForCardAfterRemove = _trelloReadWrite.Members.ForCard(_welcomeToTrelloCardWritable); + var membersForCardAfterRemove = _trelloReadWrite.Members.ForCard(cardId); - Assert.That(membersForCardAfterRemove.All(m => m.Username != "trello")); + Assert.That(membersForCardAfterRemove.All(m => m.Username != "christopherdownesward")); } [Test] @@ -418,8 +424,8 @@ public void Scenario_AddAndRemoveFileAttachment() [Test] public void Scenario_AddAndRemoveChecklist() - { - var checklist = _trelloReadWrite.Checklists.Add("a test checklist", _welcomeBoardWritable); + { + var checklist = _trelloReadWrite.Checklists.Add("a test checklist", new CardId(Constants.TestCardId2)); _trelloReadWrite.Cards.AddChecklist(_welcomeToTrelloCardWritable, checklist); var checklistsAfterAdd = _trelloReadWrite.Checklists.ForCard(_welcomeToTrelloCardWritable); @@ -438,7 +444,7 @@ public void Scenario_UpdateNameDescriptionClosedIdListAndDue() card.Name = "Updated name"; card.Desc = "Updated description"; card.Closed = true; - card.IdList = "4f41e4803374646b5c74bd62"; + card.IdList = Constants.WritableListId; card.Due = new DateTime(2015, 02, 03, 0, 0, 0, DateTimeKind.Utc); _trelloReadWrite.Cards.Update(card); @@ -456,7 +462,7 @@ public void Scenario_UpdateNameDescriptionClosedIdListAndDue() Assert.That(cardAfterUpdate.Name, Is.EqualTo("Updated name")); Assert.That(cardAfterUpdate.Desc, Is.EqualTo("Updated description")); Assert.That(cardAfterUpdate.Closed, Is.EqualTo(true)); - Assert.That(cardAfterUpdate.IdList, Is.EqualTo("4f41e4803374646b5c74bd62")); + Assert.That(cardAfterUpdate.IdList, Is.EqualTo(Constants.WritableListId)); Assert.That(cardAfterUpdate.Due, Is.EqualTo(new DateTime(2015, 02, 03, 0, 0, 0, DateTimeKind.Utc))); } @@ -494,11 +500,11 @@ public void Scenario_ChangeStateOfChecklistItem() [Test] public void Scenario_ChangePosOfCard() { - var card = _trelloReadWrite.Cards.WithId("4f41e4803374646b5c74bd9b"); + var card = _trelloReadWrite.Cards.WithId("5494346928da31ea6debaff0"); var previousPos = card.Pos; _trelloReadWrite.Cards.ChangePos(card, 1234); - var cardAfterPosChange = _trelloReadWrite.Cards.WithId("4f41e4803374646b5c74bd9b"); + var cardAfterPosChange = _trelloReadWrite.Cards.WithId("5494346928da31ea6debaff0"); Assert.That(cardAfterPosChange.Pos, Is.EqualTo(1234)); _trelloReadWrite.Cards.ChangePos(card, previousPos); @@ -507,7 +513,7 @@ public void Scenario_ChangePosOfCard() [Test] public void Scenario_ChangePosOfCardToTop() { - var card = _trelloReadWrite.Cards.WithId("4f41e4803374646b5c74bd9b"); + var card = _trelloReadWrite.Cards.WithId("549434a69c68c7a0ac3c225a"); var previousPos = card.Pos; _trelloReadWrite.Cards.ChangePos(card, Position.Top); @@ -521,14 +527,14 @@ public void Scenario_ChangePosOfCardToTop() public void Bug_Issue48_CardUpdateDeletesAllLabels() { var card = _trelloReadWrite.Cards.Add("BugIssue48", _basicsListWritable); - _trelloReadWrite.Cards.AddLabel(card, Color.Blue); + _trelloReadWrite.Cards.AddLabel(card, "blue"); card = _trelloReadWrite.Cards.WithId(card.GetCardId()); _trelloReadWrite.Cards.Update(card); card = _trelloReadWrite.Cards.WithId(card.GetCardId()); _trelloReadWrite.Cards.Delete(card); - Assert.That(card.Labels.Any(l => l.Color == Color.Blue)); + Assert.That(card.Labels.Any(l => l.Color == "blue")); } [Test] @@ -617,15 +623,108 @@ public void AddComment_CommentIsTooLong_Throws() private Card GetWelcomeToTrelloCard() { - return _trelloReadWrite.Cards.WithId("4f41e4803374646b5c74bdb0"); + return _trelloReadWrite.Cards.WithId(Constants.WelcomeCardOfTheWelcomeBoardId); } + private Card GetTrelloCard(string withId) + { + return _trelloReadWrite.Cards.WithId(withId); + } + + private static ExpectedObject CreateExpectedTestCard1() + { + return new Card + { + Id = "5493f3704c334c6ae943a966", + Name = "Card Tests: ForList_WelcomeBoardBasicsList_AllFieldsOfCardAreMapped", + Desc = "", + Closed = false, + IdList = Constants.WelcomeBoardBasicsListId, + IdBoard = Constants.WelcomeBoardId, + Due = new DateTime(2014, 12, 31, 12, 00, 00), + Labels = new List(), + IdShort = 82, + Checklists = new List(), + Url = "https://trello.com/c/ZSsdprfV/82-card-tests-forlist-welcomeboardbasicslist-allfieldsofcardaremapped", + ShortUrl = "https://trello.com/c/ZSsdprfV", + Pos = 458751, + DateLastActivity = new DateTime(2014, 12, 19, 09, 45, 54, 714), + Badges = new Card.CardBadges + { + Votes = 1, + Attachments = 1, + Comments = 2, + CheckItems = 0, + CheckItemsChecked = 0, + Description = false, + Due = new DateTime(2014, 12, 31, 12, 00, 00), + FogBugz = "" + }, + Attachments = new List + { + new Card.Attachment + { + Id = "5493f39235bb022219d199d0", + IdMember = "4f9e6801644163614d59db73", + Name = "Koala.jpg", + Url = "https://trello-attachments.s3.amazonaws.com/5493f3704c334c6ae943a966/1024x768/decdd8aa1701dc2e0fd274205c82ff6a/Koala.jpg", + Date = new DateTime(2014, 12, 19, 09, 44, 50, 694) + } + }, + IdMembers = new List { "4f9e6801644163614d59db73" } + }.ToExpectedObject(); + } + + private static ExpectedObject CreateExpectedTestCard2() + { + return new Card + { + Id = "54942eca7718c5a8c7d1fbd0", + Name = "Card Tests: ForList_WelcomeBoardBasicsList_AllFieldsOfCardAreMapped", + Desc = "", + Closed = false, + IdList = Constants.WelcomeBoardBasicsListId, + IdBoard = Constants.WelcomeBoardId, + Due = new DateTime(2015, 01, 01, 12, 00, 00), + Labels = new List(), + IdShort = 93, + Checklists = new List(), + Url = "https://trello.com/c/CdeZWqQG/93-card-tests-forlist-welcomeboardbasicslist-allfieldsofcardaremapped", + ShortUrl = "https://trello.com/c/CdeZWqQG", + Pos = 622591, + DateLastActivity = new DateTime(2014, 12, 19, 14, 03, 23, 260), + Badges = new Card.CardBadges + { + Votes = 1, + Attachments = 1, + Comments = 2, + CheckItems = 0, + CheckItemsChecked = 0, + Description = false, + Due = new DateTime(2015, 01, 01, 12, 00, 00), + FogBugz = "" + }, + Attachments = new List + { + new Card.Attachment + { + Id = "54942ef89ed53b74ace8f37d", + IdMember = "4f9e6801644163614d59db73", + Name = "Jellyfish.jpg", + Url = "https://trello-attachments.s3.amazonaws.com/54942eca7718c5a8c7d1fbd0/1024x768/1ad415bada077bb21a609a105ac47c50/Jellyfish.jpg", + Date = new DateTime(2014, 12, 19, 13, 58, 16, 215) + } + }, + IdMembers = new List { "4f9e6801644163614d59db73" } + }.ToExpectedObject(); + } + private static ExpectedObject CreateExpectedWelcomeCard() { return new Card { Id = Constants.WelcomeCardOfTheWelcomeBoardId, - Name = "Welcome to Trello!", + Name = Constants.TestCardName1, Desc = "", Closed = false, IdList = Constants.WelcomeBoardBasicsListId, diff --git a/TrelloNet.Tests/ChecklistTests.cs b/TrelloNet.Tests/ChecklistTests.cs index 1b2da86..91b4603 100644 --- a/TrelloNet.Tests/ChecklistTests.cs +++ b/TrelloNet.Tests/ChecklistTests.cs @@ -9,14 +9,14 @@ namespace TrelloNet.Tests [TestFixture] public class ChecklistTests : TrelloTestBase { - private readonly IBoardId _welcomeBoardWritable = new BoardId("4f41e4803374646b5c74bd69"); + private readonly IBoardId _welcomeBoardWritable = new BoardId(Constants.WelcomeBoardId); [Test] public void ForBoard_WelcomeBoard_ReturnsFourChecklists() { - var checkLists = _trelloReadOnly.Checklists.ForBoard(new BoardId(Constants.WelcomeBoardId)); + var checkLists = _trelloReadOnly.Checklists.ForBoard(new BoardId("4f9e6802644163614d59db7f")); - Assert.That(checkLists.Count(), Is.EqualTo(2)); + Assert.That(checkLists.Count(), Is.EqualTo(4)); } [Test] @@ -29,7 +29,7 @@ public void ForBoard_Null_Throws() [Test] public void GetByCard_TheChecklistCard_ReturnsOneChecklist() { - var checkLists = _trelloReadOnly.Checklists.ForCard(new CardId("4f2b8b4d4f2cb9d16d3684fc")); + var checkLists = _trelloReadOnly.Checklists.ForCard(new CardId(Constants.TestCardId3)); Assert.That(checkLists.Count(), Is.EqualTo(1)); } @@ -46,19 +46,18 @@ public void WithId_AChecklist_ReturnsThatChecklist() { var expectedChecklist = new Checklist { - Id = "4f2b8b4d4f2cb9d16d3684c7", + Id = "546f24e794e56071fe322419", IdBoard = Constants.WelcomeBoardId, Name = "Checklist", Pos = 16384, CheckItems = new List { - new CheckItem { Id = "4f2b8b4d4f2cb9d16d3684c4", Name = "Make your own boards", Pos = 16481 }, - new CheckItem { Id = "4f2b8b4d4f2cb9d16d3684c5", Name = "Invite your team", Pos = 33232 }, - new CheckItem { Id = "4f2b8b4d4f2cb9d16d3684c6", Name = "Enjoy an ice-cold lemonade", Pos = 49687 } + new CheckItem { Id = "546f24ebcf6d51143ddce2da", Name = "Item 1", Pos = 17236 }, + new CheckItem { Id = "546f24edde86240a2c988534", Name = "Item 2", Pos = 34510 } } }.ToExpectedObject(); - var actualChecklist = _trelloReadOnly.Checklists.WithId("4f2b8b4d4f2cb9d16d3684c7"); + var actualChecklist = _trelloReadOnly.Checklists.WithId(Constants.ChecklistId); expectedChecklist.ShouldEqual(actualChecklist); } @@ -80,8 +79,8 @@ public void ToString_EqualsName() [Test] public void Scenario_AddChecklist() - { - var checklist = _trelloReadWrite.Checklists.Add("a new checklist", _welcomeBoardWritable); + { + var checklist = _trelloReadWrite.Checklists.Add("a new checklist", new CardId(Constants.TestCardId2)); Assert.That(checklist.CheckItems.Count, Is.EqualTo(0)); Assert.That(checklist.Id, Is.Not.Empty); @@ -92,7 +91,7 @@ public void Scenario_AddChecklist() [Test] public void Scenario_ChangeNameOfAChecklist() { - var checklist = _trelloReadWrite.Checklists.Add("a checklist", _welcomeBoardWritable); + var checklist = _trelloReadWrite.Checklists.Add("a checklist", new CardId(Constants.TestCardId2)); _trelloReadWrite.Checklists.ChangeName(checklist, "a new name"); @@ -103,7 +102,7 @@ public void Scenario_ChangeNameOfAChecklist() [Test] public void Scenario_AddAndDeleteCheckItem() { - var checklist = _trelloReadWrite.Checklists.Add("a checklist", _welcomeBoardWritable); + var checklist = _trelloReadWrite.Checklists.Add("a checklist", new CardId(Constants.TestCardId2)); _trelloReadWrite.Checklists.AddCheckItem(checklist, "a new check item"); @@ -122,14 +121,14 @@ public void Scenario_AddAndDeleteCheckItem() [TestCase(null)] public void Add_NameIsInvalid_Throws(string name) { - Assert.That(() => _trelloReadWrite.Checklists.Add(name, new BoardId("dummy")), + Assert.That(() => _trelloReadWrite.Checklists.Add(name, new CardId(Constants.TestCardId2)), Throws.InstanceOf().With.Matches(e => e.ParamName == "name")); } [Test] public void Add_NameIsTooLong_Throws() { - Assert.That(() => _trelloReadWrite.Checklists.Add(new string('x', 16385), new BoardId("dummy")), + Assert.That(() => _trelloReadWrite.Checklists.Add(new string('x', 16385), new CardId(Constants.TestCardId2)), Throws.InstanceOf().With.Matches(e => e.ParamName == "name")); } @@ -166,7 +165,7 @@ public void AddCheckItem_NameIsTooLong_Throws() [Test] public void Scenario_UpdateName() { - var checklist = _trelloReadWrite.Checklists.WithId("4f41e4803374646b5c74bd67"); + var checklist = _trelloReadWrite.Checklists.WithId(Constants.ChecklistId); checklist.Name = "Updated name"; diff --git a/TrelloNet.Tests/Constants.cs b/TrelloNet.Tests/Constants.cs index f7e227d..6dbb4c6 100644 --- a/TrelloNet.Tests/Constants.cs +++ b/TrelloNet.Tests/Constants.cs @@ -2,14 +2,22 @@ namespace TrelloNet.Tests { public static class Constants { - public const string AClosedBoardId = "4f2b95f19cd939a41f512c6a"; + public const string AClosedBoardId = "548af9db794eed791f47aa5d"; public const string AnUnpinnedBoard = AClosedBoardId; public const string ABoardWithInvitationPermissionSetToOwnerId = AClosedBoardId; - public const string WelcomeBoardId = "4f2b8b4d4f2cb9d16d3684c9"; - public const string TestOrganizationId = "4f2b94c0c1c87fcb65422344"; - public const string WelcomeBoardBasicsListId = "4f2b8b4d4f2cb9d16d3684c1"; - public const string WelcomeCardOfTheWelcomeBoardId = "4f2b8b4d4f2cb9d16d3684e6"; - public const string MeId = "4f2b8b464f2cb9d16d368326"; - public const string WritableListId = "4f41e4803374646b5c74bd61"; + public const string WelcomeBoardId = "546f22e5cb8013103defe71e"; + public const string TestOrganizationId = "548b0039e035cf051fb0633d"; + public const string WelcomeBoardBasicsListId = "546f22eea6c3d57a9c63d1b6"; + public const string WelcomeCardOfTheWelcomeBoardId = "546f23273ffd00036f4d50ae"; + public const string MeId = "4f9e6801644163614d59db73"; + public const string DevelopmentId = "52efbb62fa0947a73864036a"; + public const string WritableListId = "546f22eea6c3d57a9c63d1b6"; + public const string TestBoardName = "Trello.NET Test Board"; + public const string TestCardName1 = "This is the test board for Trello.NET"; + public const string TestCardId2 = "5489c83a30bf250d785224b5"; + public const string TestCardName2 = "This is a card with a list"; + public const string ChecklistId = "546f24e794e56071fe322419"; + public const string TestActionId = "548ebd3ff579e1bf966f3a94"; + public const string TestCardId3 = "567a604fa68e80b6fa55e4fa"; } } \ No newline at end of file diff --git a/TrelloNet.Tests/Exploratory.cs b/TrelloNet.Tests/Exploratory.cs index e45d715..4fd3882 100644 --- a/TrelloNet.Tests/Exploratory.cs +++ b/TrelloNet.Tests/Exploratory.cs @@ -99,7 +99,7 @@ public void Demonstrate_Functionality() Card aNewCard = trello.Cards.Add(new NewCard("A new card", aNewList)); // Label card - trello.Cards.AddLabel(aNewCard, Color.Green); + trello.Cards.AddLabel(aNewCard, "green"); // Assign member to card trello.Cards.AddMember(aNewCard, me); @@ -116,10 +116,10 @@ public void Demonstrate_Functionality() trello.Cards.Update(aNewCard); // Create a checklist - var aNewChecklist = trello.Checklists.Add("My checklist", aNewBoard); + var aNewChecklist = trello.Checklists.Add("My checklist", aNewCard); // Add the checklist to a card - trello.Cards.AddChecklist(aNewCard, aNewChecklist); + //trello.Cards.AddChecklist(aNewCard, aNewChecklist); // Add check items trello.Checklists.AddCheckItem(aNewChecklist, "My check item"); diff --git a/TrelloNet.Tests/ListTests.cs b/TrelloNet.Tests/ListTests.cs index 88eb7f4..b9bf234 100644 --- a/TrelloNet.Tests/ListTests.cs +++ b/TrelloNet.Tests/ListTests.cs @@ -8,7 +8,7 @@ namespace TrelloNet.Tests [TestFixture] public class ListTests : TrelloTestBase { - private readonly IBoardId _welcomeBoardWritable = new BoardId("4f41e4803374646b5c74bd69"); + private readonly IBoardId _welcomeBoardWritable = new BoardId(Constants.WelcomeBoardId); private readonly IListId _basicsListWritable = new ListId(Constants.WritableListId); [Test] @@ -39,17 +39,20 @@ public void ForBoard_WelcomeBoard_AllFieldsOfListAreMapped() } [Test] - public void ForBoard_WelcomeBoard_ReturnsThreeLists() + public void ForBoard_WelcomeBoard_ReturnsCorrectLists() { var lists = _trelloReadOnly.Lists.ForBoard(new BoardId(Constants.WelcomeBoardId)); - Assert.That(lists, Has.Count.EqualTo(3)); + Assert.That(lists, Has.Count.EqualTo(4)); } + /** + * Must a use a differenent board to other tests, as the other tests add closed boards + */ [Test] public void ForBoard_WelcomeBoardAndClosed_ReturnsTwoLists() { - var lists = _trelloReadOnly.Lists.ForBoard(new BoardId(Constants.WelcomeBoardId), ListFilter.Closed); + var lists = _trelloReadOnly.Lists.ForBoard(new BoardId("4f9e6802644163614d59db7f"), ListFilter.Closed); Assert.That(lists, Has.Count.EqualTo(2)); } @@ -204,7 +207,7 @@ private static ExpectedObject CreateExpectedBasicsList() Id = Constants.WelcomeBoardBasicsListId, IdBoard = Constants.WelcomeBoardId, Name = "Basics", - Pos = 16384 + Pos = 65535 }.ToExpectedObject(); } } diff --git a/TrelloNet.Tests/MemberTests.cs b/TrelloNet.Tests/MemberTests.cs index a785e29..48ae3a9 100644 --- a/TrelloNet.Tests/MemberTests.cs +++ b/TrelloNet.Tests/MemberTests.cs @@ -11,7 +11,7 @@ public class MemberTests : TrelloTestBase [Test] public void Me_Always_ReturnsTheMemberMe() { - var expectedMe = CreateExpectedMemberMe(); + var expectedMe = CreateExpectedMemberCDW(); var actualMe = _trelloReadOnly.Members.Me(); @@ -58,7 +58,7 @@ public void WithId_Null_Throws() [Test] public void ForCard_WelcomeCardOfTheWelcomeBoard_ReturnsMeOnly() { - var members = _trelloReadOnly.Members.ForCard(new CardId(Constants.WelcomeCardOfTheWelcomeBoardId)); + var members = _trelloReadOnly.Members.ForCard(new CardId("549308215c17338c1ce717c9")); Assert.That(members.Count(), Is.EqualTo(1)); Assert.That(members.First().Id, Is.EqualTo(Constants.MeId)); @@ -67,9 +67,9 @@ public void ForCard_WelcomeCardOfTheWelcomeBoard_ReturnsMeOnly() [Test] public void ForCard_WelcomeCardOfTheWelcomeBoard_AllFieldsOfMemberAreMapped() { - var expectedMember = CreateExpectedMemberMe(); + var expectedMember = CreateExpectedMemberCDW(); - var actualMember = _trelloReadOnly.Members.ForCard(new CardId(Constants.WelcomeCardOfTheWelcomeBoardId)).Single(m => m.Id == Constants.MeId); + var actualMember = _trelloReadOnly.Members.ForCard(new CardId("549308215c17338c1ce717c9")).Single(m => m.Id == Constants.MeId); expectedMember.ShouldMatch(actualMember); } @@ -100,7 +100,7 @@ public void InvitedForBoard_WelcomeBoard_Returns1Member() [Test] public void ForBoard_WelcomeBoard_AllFieldsOfMemberAreMapped() { - var expectedMember = CreateExpectedMemberMe(); + var expectedMember = CreateExpectedMemberCDW(); var actualMember = _trelloReadOnly.Members.ForBoard(new BoardId(Constants.WelcomeBoardId)).Single(m => m.Id == Constants.MeId); @@ -112,7 +112,7 @@ public void ForBoard_WelcomeBoardAndFilterOwner_ReturnsOneMember() { var members = _trelloReadOnly.Members.ForBoard(new BoardId(Constants.WelcomeBoardId), MemberFilter.Owners); - Assert.That(members.Count(), Is.EqualTo(1)); + Assert.That(members.Count(), Is.EqualTo(2)); Assert.That(members.First().Id, Is.EqualTo(Constants.MeId)); } @@ -128,14 +128,14 @@ public void ForOrganization_TestOrganization_ReturnsMe() { var members = _trelloReadOnly.Members.ForOrganization(new OrganizationId(Constants.TestOrganizationId)); - Assert.That(members.Count(), Is.EqualTo(1)); + Assert.That(members.Count(), Is.EqualTo(2)); Assert.That(members.First().Id, Is.EqualTo(Constants.MeId)); } [Test] public void ForOrganization_TestOrganization_AllFieldsOfMemberAreMapped() { - var expectedMember = CreateExpectedMemberMe(); + var expectedMember = CreateExpectedMemberCDW(); var actualMember = _trelloReadOnly.Members.ForOrganization(new OrganizationId(Constants.TestOrganizationId)).Single(m => m.Id == Constants.MeId); @@ -152,9 +152,9 @@ public void ForOrganization_Null_Throws() [Test] public void ForToken_TokenOfMe_ReturnsMe() { - var expected = CreateExpectedMemberMe(); + var expected = CreateExpectedMemberCDW(); - var member = _trelloReadOnly.Members.ForToken("a0f05ce01f11b4dceb1127e244bdc9c45705d44f3ec1b349f3f4a4c306e20fcf"); + var member = _trelloReadOnly.Members.ForToken("4f1ecd33625aab4a75c3d19622b09dbe03e9944a9ec8c97adec2c1e9eaf585c3"); expected.ShouldMatch(member); } @@ -198,5 +198,17 @@ private static ExpectedObject CreateExpectedMemberTrello() Status = MemberStatus.Disconnected }.ToExpectedObject(); } + + private static ExpectedObject CreateExpectedMemberCDW() + { + return new + { + FullName = "Christopher Downes-Ward", + Username = "christopherdownesward", + Id = "4f9e6801644163614d59db73", + AvatarHash = "5db13c831c6f50ac6e97217bc77f4034", + Initials = "CDW" + }.ToExpectedObject(); + } } } \ No newline at end of file diff --git a/TrelloNet.Tests/OrganizationTests.cs b/TrelloNet.Tests/OrganizationTests.cs index 6818715..116ac99 100644 --- a/TrelloNet.Tests/OrganizationTests.cs +++ b/TrelloNet.Tests/OrganizationTests.cs @@ -32,7 +32,7 @@ public void ForMember_Me_ReturnsTestOrganization() var organizations = _trelloReadOnly.Organizations.ForMe(); - Assert.That(organizations.Count(), Is.EqualTo(1)); + Assert.That(organizations.Count(), Is.EqualTo(2)); expectedOrganization.ShouldEqual(organizations.First()); } @@ -52,7 +52,7 @@ public void ForMember_MeAndFilterMember_ReturnsTestOrganization() var organizations = _trelloReadOnly.Organizations.ForMember(new Me(), OrganizationFilter.Members); - Assert.That(organizations.Count(), Is.EqualTo(1)); + Assert.That(organizations.Count(), Is.EqualTo(2)); expectedOrganization.ShouldEqual(organizations.First()); } @@ -92,13 +92,13 @@ private static ExpectedObject CreateExpectedOrganization() { return new Organization { - Id = "4f2b94c0c1c87fcb65422344", - DisplayName = "Trello.NET Test Organization", - Name = "trellnettestorganization", - Desc = "organization description", - Url = "https://trello.com/trellnettestorganization", - Website = "http://www.test.com", - LogoHash = "8837fa152a12383f829cc754a6485ea9" + Id = "548b0039e035cf051fb0633d", + DisplayName = "Test Organisation", + Name = "testorganisation78", + Desc = "A tello.Net test organisation", + Url = "https://trello.com/testorganisation78", + Website = "http://www.thisisnumero.com", + LogoHash = "4563880a8fd49bc297bfdb174d7f8cca" }.ToExpectedObject(); } } diff --git a/TrelloNet.Tests/SearchTests.cs b/TrelloNet.Tests/SearchTests.cs index bc566cc..fed853e 100644 --- a/TrelloNet.Tests/SearchTests.cs +++ b/TrelloNet.Tests/SearchTests.cs @@ -47,11 +47,11 @@ public void Search_WithTestQuery_ReturnsCorrectBoard() var expected = new Board { Closed = false, - Name = "Welcome Board", - Desc = "A test description", + Name = Constants.TestBoardName, IdOrganization = Constants.TestOrganizationId, - Pinned = true, - Url = "https://trello.com/b/J9JUdoYV/welcome-board", + Pinned = false, + Starred = true, + Url = "https://trello.com/b/UTWsO3Jc/trello-net-test-board", Id = Constants.WelcomeBoardId, Prefs = new BoardPreferences { @@ -60,18 +60,22 @@ public void Search_WithTestQuery_ReturnsCorrectBoard() PermissionLevel = PermissionLevel.Private, Voting = VotingPermission.Members }, - LabelNames = new Dictionary + LabelNames = new Dictionary { - { Color.Yellow, "" }, - { Color.Red, "" }, - { Color.Purple, "" }, - { Color.Orange, "" }, - { Color.Green, "label name" }, - { Color.Blue, "" }, + { "green", "" }, + { "yellow", "" }, + { "orange", "" }, + { "red", "" }, + { "purple", "" }, + { "blue", "" }, + { "sky", "" }, + { "lime", "" }, + { "pink", "" }, + { "black", "" }, } }.ToExpectedObject(); - var actual = _trelloReadOnly.Search("Welcome Board").Boards.First(); + var actual = _trelloReadOnly.Search(Constants.TestBoardName).Boards.First(); expected.ShouldEqual(actual); } @@ -81,19 +85,19 @@ public void Search_WithTestQuery_ReturnsCorrectCard() { var expected = new Card { - Id = Constants.WelcomeCardOfTheWelcomeBoardId, - Name = "Welcome to Trello!", + Id = "54915d3a6c094da5f474c559", + Name = "Search test card", Desc = "", Closed = false, IdList = Constants.WelcomeBoardBasicsListId, IdBoard = Constants.WelcomeBoardId, - Due = new DateTime(2015, 01, 01, 09, 00, 00), + Due = new DateTime(2015, 01, 01, 12, 00, 00), Labels = new List(), - IdShort = 1, - Url = "https://trello.com/c/pD2NljjG/1-welcome-to-trello", - ShortUrl = "https://trello.com/c/pD2NljjG", - Pos = 32768, - DateLastActivity = new DateTime(2012, 03, 24, 22, 48, 26, 596), + IdShort = 66, + Url = "https://trello.com/c/acv9Fblm/66-search-test-card", + ShortUrl = "https://trello.com/c/acv9Fblm", + Pos = 327679, + DateLastActivity = new DateTime(2014, 12, 17, 10, 43, 23, 012), Badges = new Card.CardBadges { Votes = 1, @@ -102,13 +106,13 @@ public void Search_WithTestQuery_ReturnsCorrectCard() CheckItems = 0, CheckItemsChecked = 0, Description = false, - Due = new DateTime(2015, 01, 01, 09, 00, 00), + Due = new DateTime(2015, 01, 01, 12, 00, 00), FogBugz = "" }, - IdMembers = new List { "4f2b8b464f2cb9d16d368326" } + IdMembers = new List { "4f9e6801644163614d59db73" } }.ToExpectedObject(); - var actual = _trelloReadOnly.Search("Welcome to Trello").Cards.First(); + var actual = _trelloReadOnly.Search("Search test card").Cards.First(); expected.ShouldEqual(actual); } @@ -118,16 +122,14 @@ public void Search_WithTestQuery_ReturnsCorrectMember() { var expected = new { - FullName = "Trello.NET Test User", - Bio = "Test bio", - Url = "https://trello.com/trellnettestuser", - Username = "trellnettestuser", - Id = Constants.MeId, - AvatarHash = "076e3caed758a1c18c91a0e9cae3368f", - Initials = "TU" + FullName = "Christopher Downes-Ward", + Username = "christopherdownesward", + Id = "4f9e6801644163614d59db73", + AvatarHash = "5db13c831c6f50ac6e97217bc77f4034", + Initials = "CDW" }.ToExpectedObject(); - var actual = _trelloReadOnly.Search("Trello.NET Test User").Members.First(); + var actual = _trelloReadOnly.Search("Christopher Downes-Ward").Members.First(); expected.ShouldMatch(actual); } diff --git a/TrelloNet.Tests/TokenTests.cs b/TrelloNet.Tests/TokenTests.cs index 8bed490..7393047 100644 --- a/TrelloNet.Tests/TokenTests.cs +++ b/TrelloNet.Tests/TokenTests.cs @@ -13,9 +13,9 @@ public void WithToken_AToken_ReturnsExpectedToken() { var expected = new Token { - Id = "4f588114f57acfa95fa5065b", + Id = "548ea388f23678d905018f36", IdMember = Constants.MeId, - DateCreated = new DateTime(2012, 03, 08, 09, 51, 16, 806), + DateCreated = new DateTime(2014, 12, 15, 09, 02, 00, 446), Permissions = new List { new Token.TokenPermissions @@ -35,7 +35,7 @@ public void WithToken_AToken_ReturnsExpectedToken() } }.ToExpectedObject(); - var actual = _trelloReadOnly.Tokens.WithToken("a0f05ce01f11b4dceb1127e244bdc9c45705d44f3ec1b349f3f4a4c306e20fcf"); + var actual = _trelloReadOnly.Tokens.WithToken("4f1ecd33625aab4a75c3d19622b09dbe03e9944a9ec8c97adec2c1e9eaf585c3"); expected.ShouldEqual(actual); } diff --git a/TrelloNet.Tests/TrelloNet.Tests.csproj b/TrelloNet.Tests/TrelloNet.Tests.csproj index 4d7c952..9c1e3e6 100644 --- a/TrelloNet.Tests/TrelloNet.Tests.csproj +++ b/TrelloNet.Tests/TrelloNet.Tests.csproj @@ -43,7 +43,7 @@ False - ..\packages\Newtonsoft.Json.6.0.3\lib\net40\Newtonsoft.Json.dll + ..\packages\Newtonsoft.Json.6.0.6\lib\net40\Newtonsoft.Json.dll False @@ -84,7 +84,9 @@ - + + Designer + diff --git a/TrelloNet.Tests/packages.config b/TrelloNet.Tests/packages.config index 9f96158..2aba95d 100644 --- a/TrelloNet.Tests/packages.config +++ b/TrelloNet.Tests/packages.config @@ -2,7 +2,7 @@ - + \ No newline at end of file diff --git a/TrelloNet/Actions/AddMemberToBoardAction.cs b/TrelloNet/Actions/AddMemberToBoardAction.cs index 213c548..707f74e 100644 --- a/TrelloNet/Actions/AddMemberToBoardAction.cs +++ b/TrelloNet/Actions/AddMemberToBoardAction.cs @@ -7,7 +7,7 @@ public class AddMemberToBoardAction : Action public class ActionData { public BoardName Board { get; set; } - public string IdMember { get; set; } + public string IdMemberAdded { get; set; } } } } \ No newline at end of file diff --git a/TrelloNet/Actions/ConvertToCardFromCheckItemAction.cs b/TrelloNet/Actions/ConvertToCardFromCheckItemAction.cs index ab475c1..114d57b 100644 --- a/TrelloNet/Actions/ConvertToCardFromCheckItemAction.cs +++ b/TrelloNet/Actions/ConvertToCardFromCheckItemAction.cs @@ -8,9 +8,8 @@ public class ActionData { public CardName CardSource { get; set; } public CardName Card { get; set; } - public ChecklistName Checklist { get; set; } + public ListName List { get; set; } public BoardName Board { get; set; } - public CheckItemName CheckItem { get; set; } } } } \ No newline at end of file diff --git a/TrelloNet/Actions/RemoveFromOrganizationBoardAction.cs b/TrelloNet/Actions/RemoveFromOrganizationBoardAction.cs index 233348c..3f623fe 100644 --- a/TrelloNet/Actions/RemoveFromOrganizationBoardAction.cs +++ b/TrelloNet/Actions/RemoveFromOrganizationBoardAction.cs @@ -7,6 +7,7 @@ public class RemoveFromOrganizationBoardAction : Action public class ActionData { public BoardName Board { get; set; } + public OrganizationName Organization { get; set; } } } } \ No newline at end of file diff --git a/TrelloNet/Boards/Board.cs b/TrelloNet/Boards/Board.cs index e5d9dd3..ebf7114 100644 --- a/TrelloNet/Boards/Board.cs +++ b/TrelloNet/Boards/Board.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using Newtonsoft.Json; +using System; namespace TrelloNet { @@ -7,17 +8,19 @@ public class Board : IBoardId, IUpdatableBoard { public string Id { get; set; } public string Name { get; set; } - public string Desc { get; set; } public bool Closed { get; set; } public string IdOrganization { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public bool Pinned { get; set; } + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public bool Starred { get; set; } + public string Url { get; set; } public BoardPreferences Prefs { get; set; } public bool Invited { get; set; } - public Dictionary LabelNames { get; set; } + public Dictionary LabelNames { get; set; } public string GetBoardId() { diff --git a/TrelloNet/Boards/IAsyncBoards.cs b/TrelloNet/Boards/IAsyncBoards.cs index b303f49..5c1d4d7 100644 --- a/TrelloNet/Boards/IAsyncBoards.cs +++ b/TrelloNet/Boards/IAsyncBoards.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Threading.Tasks; using TrelloNet.Internal; +using System; namespace TrelloNet { @@ -152,6 +153,6 @@ public interface IAsyncBoards ///
/// required permissions: own, write /// - Task ChangeLabelName(IBoardId board, Color color, string name); + Task ChangeLabelName(IBoardId board, String color, string name); } } \ No newline at end of file diff --git a/TrelloNet/Boards/IBoards.cs b/TrelloNet/Boards/IBoards.cs index 10eb015..04bc17c 100644 --- a/TrelloNet/Boards/IBoards.cs +++ b/TrelloNet/Boards/IBoards.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using TrelloNet.Internal; +using System; namespace TrelloNet { @@ -151,6 +152,6 @@ public interface IBoards ///
/// required permissions: own, write /// - void ChangeLabelName(IBoardId board, Color color, string name); + void ChangeLabelName(IBoardId board, String color, string name); } } \ No newline at end of file diff --git a/TrelloNet/Boards/IUpdatableBoard.cs b/TrelloNet/Boards/IUpdatableBoard.cs index 314fc3f..b467b2b 100644 --- a/TrelloNet/Boards/IUpdatableBoard.cs +++ b/TrelloNet/Boards/IUpdatableBoard.cs @@ -4,7 +4,6 @@ public interface IUpdatableBoard { string Id { get; } string Name { get; } - string Desc { get; } bool Closed { get; } } } \ No newline at end of file diff --git a/TrelloNet/Boards/Internal/AsyncBoards.cs b/TrelloNet/Boards/Internal/AsyncBoards.cs index 3171f13..86266e2 100644 --- a/TrelloNet/Boards/Internal/AsyncBoards.cs +++ b/TrelloNet/Boards/Internal/AsyncBoards.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Threading.Tasks; +using System; namespace TrelloNet.Internal { @@ -113,7 +114,7 @@ public Task RemoveMember(IBoardId board, IMemberId member) return _restClient.RequestAsync(new BoardsRemoveMemberRequest(board, member)); } - public Task ChangeLabelName(IBoardId board, Color color, string name) + public Task ChangeLabelName(IBoardId board, String color, string name) { return _restClient.RequestAsync(new BoardsChangeLabelNameRequest(board, color, name)); } diff --git a/TrelloNet/Boards/Internal/Boards.cs b/TrelloNet/Boards/Internal/Boards.cs index c4a16a5..bcba2bf 100644 --- a/TrelloNet/Boards/Internal/Boards.cs +++ b/TrelloNet/Boards/Internal/Boards.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System; namespace TrelloNet.Internal { @@ -111,7 +112,7 @@ public void RemoveMember(IBoardId board, IMemberId member) _restClient.Request(new BoardsRemoveMemberRequest(board, member)); } - public void ChangeLabelName(IBoardId board, Color color, string name) + public void ChangeLabelName(IBoardId board, String color, string name) { _restClient.Request(new BoardsChangeLabelNameRequest(board, color, name)); } diff --git a/TrelloNet/Boards/Internal/BoardsChangeLabelNameRequest.cs b/TrelloNet/Boards/Internal/BoardsChangeLabelNameRequest.cs index 56c85bd..8437155 100644 --- a/TrelloNet/Boards/Internal/BoardsChangeLabelNameRequest.cs +++ b/TrelloNet/Boards/Internal/BoardsChangeLabelNameRequest.cs @@ -1,13 +1,14 @@ using RestSharp; +using System; namespace TrelloNet.Internal { internal class BoardsChangeLabelNameRequest : BoardsRequest { - public BoardsChangeLabelNameRequest(IBoardId board, Color color, string name) + public BoardsChangeLabelNameRequest(IBoardId board, String color, string name) : base(board, "labelNames/{color}", Method.PUT) { - AddParameter("color", color.ToTrelloString(), ParameterType.UrlSegment); + AddParameter("color", color, ParameterType.UrlSegment); this.AddValue(name ?? ""); } } diff --git a/TrelloNet/Boards/Internal/BoardsUpdateRequest.cs b/TrelloNet/Boards/Internal/BoardsUpdateRequest.cs index b47fdc5..005f82d 100644 --- a/TrelloNet/Boards/Internal/BoardsUpdateRequest.cs +++ b/TrelloNet/Boards/Internal/BoardsUpdateRequest.cs @@ -8,10 +8,8 @@ public BoardsUpdateRequest(IUpdatableBoard board) : base(board.Id, method: Method.PUT) { Guard.RequiredTrelloString(board.Name, "name"); - Guard.OptionalTrelloString(board.Desc, "desc"); AddParameter("name", board.Name); - AddParameter("desc", board.Desc); AddParameter("closed", board.Closed.ToTrelloString()); } } diff --git a/TrelloNet/Boards/Internal/BoardsWithIdRequest.cs b/TrelloNet/Boards/Internal/BoardsWithIdRequest.cs index cab16cf..5061270 100644 --- a/TrelloNet/Boards/Internal/BoardsWithIdRequest.cs +++ b/TrelloNet/Boards/Internal/BoardsWithIdRequest.cs @@ -4,7 +4,7 @@ internal class BoardsWithIdRequest : BoardsRequest { public BoardsWithIdRequest(string boardId) : base(boardId) { - AddParameter("fields", "name,desc,closed,idOrganization,pinned,url,prefs,labelNames"); + AddParameter("fields", "name,desc,closed,idOrganization,pinned,starred,url,prefs,labelNames"); } } } \ No newline at end of file diff --git a/TrelloNet/Cards/Card.cs b/TrelloNet/Cards/Card.cs index e4cc279..28613a5 100644 --- a/TrelloNet/Cards/Card.cs +++ b/TrelloNet/Cards/Card.cs @@ -25,7 +25,7 @@ public class Card : ICardId, IUpdatableCard public double Pos { get; set; } public DateTime DateLastActivity { get; set; } public List IdMembers { get; set; } - public IEnumerable LabelColors { get { return Labels == null ? Enumerable.Empty() : Labels.Select(l => l.Color); } } + public IEnumerable LabelColors { get { return Labels == null ? Enumerable.Empty() : Labels.Select(l => l.Color); } } public string GetCardId() { @@ -39,7 +39,7 @@ public override string ToString() public class Label { - public Color Color { get; set; } + public String Color { get; set; } public string Name { get; set; } } diff --git a/TrelloNet/Cards/Color.cs b/TrelloNet/Cards/Color.cs deleted file mode 100644 index c6a312c..0000000 --- a/TrelloNet/Cards/Color.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace TrelloNet -{ - public enum Color - { - Green, - Yellow, - Orange, - Red, - Purple, - Blue - } -} \ No newline at end of file diff --git a/TrelloNet/Cards/IAsyncCards.cs b/TrelloNet/Cards/IAsyncCards.cs index 196edec..4218e9e 100644 --- a/TrelloNet/Cards/IAsyncCards.cs +++ b/TrelloNet/Cards/IAsyncCards.cs @@ -164,14 +164,14 @@ public interface IAsyncCards ///
/// Required permissions: write /// - Task AddLabel(ICardId card, Color color); + Task AddLabel(ICardId card, String color); /// /// DELETE /cards/[card_id]/labels/[color] ///
/// Required permissions: write ///
- Task RemoveLabel(ICardId card, Color color); + Task RemoveLabel(ICardId card, String color); /// /// POST /cards/[card_id]/members diff --git a/TrelloNet/Cards/ICards.cs b/TrelloNet/Cards/ICards.cs index 3039724..3eba44f 100644 --- a/TrelloNet/Cards/ICards.cs +++ b/TrelloNet/Cards/ICards.cs @@ -163,14 +163,14 @@ public interface ICards ///
/// Required permissions: write ///
- void AddLabel(ICardId card, Color color); + void AddLabel(ICardId card, String color); /// /// DELETE /cards/[card_id]/labels/[color] ///
/// Required permissions: write ///
- void RemoveLabel(ICardId card, Color color); + void RemoveLabel(ICardId card, String color); /// /// POST /cards/[card_id]/members diff --git a/TrelloNet/Cards/IUpdatableCard.cs b/TrelloNet/Cards/IUpdatableCard.cs index 9268839..a22addc 100644 --- a/TrelloNet/Cards/IUpdatableCard.cs +++ b/TrelloNet/Cards/IUpdatableCard.cs @@ -11,6 +11,6 @@ public interface IUpdatableCard bool Closed { get; } string IdList { get; } DateTime? Due { get; } - IEnumerable LabelColors { get; } + IEnumerable LabelColors { get; } } } \ No newline at end of file diff --git a/TrelloNet/Cards/Internal/AsyncCards.cs b/TrelloNet/Cards/Internal/AsyncCards.cs index f5121f0..7cff57d 100644 --- a/TrelloNet/Cards/Internal/AsyncCards.cs +++ b/TrelloNet/Cards/Internal/AsyncCards.cs @@ -118,12 +118,12 @@ public Task Move(ICardId card, IBoardId board, IListId list = null) return _restClient.RequestAsync(new CardsMoveToBoardRequest(card, board, list)); } - public Task AddLabel(ICardId card, Color color) + public Task AddLabel(ICardId card, String color) { return _restClient.RequestAsync(new CardsAddLabelRequest(card, color)); } - public Task RemoveLabel(ICardId card, Color color) + public Task RemoveLabel(ICardId card, String color) { return _restClient.RequestAsync(new CardsRemoveLabelRequest(card, color)); } diff --git a/TrelloNet/Cards/Internal/Cards.cs b/TrelloNet/Cards/Internal/Cards.cs index 8ac599f..302347d 100644 --- a/TrelloNet/Cards/Internal/Cards.cs +++ b/TrelloNet/Cards/Internal/Cards.cs @@ -107,12 +107,12 @@ public void Move(ICardId card, IBoardId board, IListId list = null) _restClient.Request(new CardsMoveToBoardRequest(card, board, list)); } - public void AddLabel(ICardId card, Color color) + public void AddLabel(ICardId card, String color) { _restClient.Request(new CardsAddLabelRequest(card, color)); } - public void RemoveLabel(ICardId card, Color color) + public void RemoveLabel(ICardId card, String color) { _restClient.Request(new CardsRemoveLabelRequest(card, color)); } diff --git a/TrelloNet/Cards/Internal/CardsAddLabelRequest.cs b/TrelloNet/Cards/Internal/CardsAddLabelRequest.cs index 486933a..fc5d55a 100644 --- a/TrelloNet/Cards/Internal/CardsAddLabelRequest.cs +++ b/TrelloNet/Cards/Internal/CardsAddLabelRequest.cs @@ -1,13 +1,14 @@ using RestSharp; +using System; namespace TrelloNet.Internal { internal class CardsAddLabelRequest : CardsRequest { - public CardsAddLabelRequest(ICardId card, Color color) + public CardsAddLabelRequest(ICardId card, String color) : base(card, "labels", Method.POST) { - this.AddValue(color.ToTrelloString()); + this.AddValue(color); } } } \ No newline at end of file diff --git a/TrelloNet/Cards/Internal/CardsRemoveLabelRequest.cs b/TrelloNet/Cards/Internal/CardsRemoveLabelRequest.cs index 270cc18..51a666a 100644 --- a/TrelloNet/Cards/Internal/CardsRemoveLabelRequest.cs +++ b/TrelloNet/Cards/Internal/CardsRemoveLabelRequest.cs @@ -1,13 +1,14 @@ using RestSharp; +using System; namespace TrelloNet.Internal { internal class CardsRemoveLabelRequest : CardsRequest { - public CardsRemoveLabelRequest(ICardId card, Color color) + public CardsRemoveLabelRequest(ICardId card, String color) : base(card, "labels/{color}", Method.DELETE) { - AddParameter("color", color.ToTrelloString(), ParameterType.UrlSegment); + AddParameter("color", color, ParameterType.UrlSegment); } } } \ No newline at end of file diff --git a/TrelloNet/Cards/Internal/CardsUpdateRequest.cs b/TrelloNet/Cards/Internal/CardsUpdateRequest.cs index d1f20f4..cd4459c 100644 --- a/TrelloNet/Cards/Internal/CardsUpdateRequest.cs +++ b/TrelloNet/Cards/Internal/CardsUpdateRequest.cs @@ -19,7 +19,7 @@ public CardsUpdateRequest(IUpdatableCard card) AddParameter("closed", card.Closed.ToTrelloString()); AddParameter("idList", card.IdList); AddParameter("due", card.Due == null ? null : new DateTimeOffset(card.Due.Value).ToString(CultureInfo.InvariantCulture)); - AddParameter("labels", string.Join(",", card.LabelColors.Select(c => c.ToTrelloString()))); + AddParameter("labels", string.Join(",", card.LabelColors.Select(c => c))); } } } \ No newline at end of file diff --git a/TrelloNet/Checklists/IAsyncChecklists.cs b/TrelloNet/Checklists/IAsyncChecklists.cs index 04d29ae..af676bb 100644 --- a/TrelloNet/Checklists/IAsyncChecklists.cs +++ b/TrelloNet/Checklists/IAsyncChecklists.cs @@ -32,7 +32,7 @@ public interface IAsyncChecklists /// Required permissions: write /// /// A string with a length from 1 to 16384. - Task Add(string name, IBoardId board); + Task Add(string name, ICardId card); /// /// PUT /checklists/[checklist_id]/name diff --git a/TrelloNet/Checklists/IChecklists.cs b/TrelloNet/Checklists/IChecklists.cs index 4fac015..a26a1a4 100644 --- a/TrelloNet/Checklists/IChecklists.cs +++ b/TrelloNet/Checklists/IChecklists.cs @@ -31,7 +31,7 @@ public interface IChecklists /// Required permissions: write /// /// A string with a length from 1 to 16384. - Checklist Add(string name, IBoardId board); + Checklist Add(string name, ICardId card); /// /// PUT /checklists/[checklist_id]/name diff --git a/TrelloNet/Checklists/Internal/AsyncChecklists.cs b/TrelloNet/Checklists/Internal/AsyncChecklists.cs index 9cdebb6..471b8d3 100644 --- a/TrelloNet/Checklists/Internal/AsyncChecklists.cs +++ b/TrelloNet/Checklists/Internal/AsyncChecklists.cs @@ -27,9 +27,9 @@ public Task> ForCard(ICardId card) return _restClient.RequestListAsync(new ChecklistsForCardRequest(card)); } - public Task Add(string name, IBoardId board) + public Task Add(string name, ICardId card) { - return _restClient.RequestAsync(new ChecklistsAddRequest(board, name)); + return _restClient.RequestAsync(new ChecklistsAddRequest(card, name)); } public Task ChangeName(IChecklistId checklist, string name) diff --git a/TrelloNet/Checklists/Internal/Checklists.cs b/TrelloNet/Checklists/Internal/Checklists.cs index 9a2c24d..780cbbc 100644 --- a/TrelloNet/Checklists/Internal/Checklists.cs +++ b/TrelloNet/Checklists/Internal/Checklists.cs @@ -26,9 +26,9 @@ public IEnumerable ForCard(ICardId card) return _restClient.Request>(new ChecklistsForCardRequest(card)); } - public Checklist Add(string name, IBoardId board) + public Checklist Add(string name, ICardId card) { - return _restClient.Request(new ChecklistsAddRequest(board, name)); + return _restClient.Request(new ChecklistsAddRequest(card, name)); } public void ChangeName(IChecklistId checklist, string name) diff --git a/TrelloNet/Checklists/Internal/ChecklistsAddRequest.cs b/TrelloNet/Checklists/Internal/ChecklistsAddRequest.cs index 4eecc06..979f868 100644 --- a/TrelloNet/Checklists/Internal/ChecklistsAddRequest.cs +++ b/TrelloNet/Checklists/Internal/ChecklistsAddRequest.cs @@ -2,10 +2,10 @@ namespace TrelloNet.Internal { - internal class ChecklistsAddRequest : BoardsRequest + internal class ChecklistsAddRequest : CardsRequest { - public ChecklistsAddRequest(IBoardId board, string name) - : base(board, "checklists", Method.POST) + public ChecklistsAddRequest(ICardId card, string name) + : base(card, "checklists", Method.POST) { Guard.RequiredTrelloString(name, "name"); AddParameter("name", name); diff --git a/TrelloNet/Properties/AssemblyInfo.cs b/TrelloNet/Properties/AssemblyInfo.cs index daf9f37..049a2e5 100644 --- a/TrelloNet/Properties/AssemblyInfo.cs +++ b/TrelloNet/Properties/AssemblyInfo.cs @@ -31,6 +31,6 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyInformationalVersion("0.6.2")] -[assembly: AssemblyVersion("0.6.2.0")] -[assembly: AssemblyFileVersion("0.6.2.0")] \ No newline at end of file +[assembly: AssemblyInformationalVersion("0.6.5")] +[assembly: AssemblyVersion("0.6.5.0")] +[assembly: AssemblyFileVersion("0.6.5.0")] \ No newline at end of file diff --git a/TrelloNet/TrelloNet.csproj b/TrelloNet/TrelloNet.csproj index 9f99ff8..6ed11f2 100644 --- a/TrelloNet/TrelloNet.csproj +++ b/TrelloNet/TrelloNet.csproj @@ -41,7 +41,7 @@ False - ..\packages\Newtonsoft.Json.6.0.3\lib\net40\Newtonsoft.Json.dll + ..\packages\Newtonsoft.Json.6.0.6\lib\net40\Newtonsoft.Json.dll False @@ -197,7 +197,6 @@ - diff --git a/TrelloNet/packages.config b/TrelloNet/packages.config index 2845437..2a8bd3a 100644 --- a/TrelloNet/packages.config +++ b/TrelloNet/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file