public void CallWillDeleteCard() { Board board = GetSampleBoard(); _apiMock.Expect(x => x.GetBoard(1)).Return(board); _apiMock.Expect(x => x.DeleteCard(Arg<long>.Is.Anything, Arg<long>.Is.Anything)).Return(1); _integration = new LeanKitIntegration(1, _apiMock); _integration.ShouldContinue = false; _integration.StartWatching(); _integration.DeleteCard(1); _integration.GetCard(1); }
public void CallWillMoveCard() { Board board = GetSampleBoard(); _apiMock.Expect(x => x.GetBoard(1)).Return(board); _apiMock.Expect( x => x.MoveCard(Arg<long>.Is.Anything, Arg<long>.Is.Anything, Arg<long>.Is.Anything, Arg<int>.Is.Anything)) .Return(1); _integration = new LeanKitIntegration(1, _apiMock); _integration.ShouldContinue = false; _integration.StartWatching(); _integration.MoveCard(1, 2, 1); Card card = _integration.GetCard(1); Assert.NotNull(card); Assert.AreEqual(2, card.LaneId); Assert.AreEqual(1, board.GetLaneById(2).Cards[0].Id); Assert.IsNull(board.GetLaneById(1).Cards.FirstOrDefault(x => x.Id == 1)); }
public void CallWillUpdateCard() { Board board = GetSampleBoard(); _apiMock.Expect(x => x.GetBoard(1)).Return(board); Card cardToUpdate = new Card { Id = 1, Title = "Card 1 Updated", LaneId = 1, Description = "some desc 1", TypeId = 1, ExternalCardID = "123" }; CardUpdateResult result = new CardUpdateResult {BoardVersion = 1, CardDTO = cardToUpdate.ToCardView()}; _apiMock.Expect(x => x.UpdateCard(Arg<long>.Is.Anything, Arg<Card>.Is.Anything)).Return(result); _integration = new LeanKitIntegration(1, _apiMock); _integration.ShouldContinue = false; _integration.StartWatching(); _integration.UpdateCard(cardToUpdate); Card card = _integration.GetCard(1); Assert.NotNull(card); Assert.AreEqual("Card 1 Updated", card.Title); }
public void CallWillAddCard() { Board board = GetSampleBoard(); _apiMock.Expect(x => x.GetBoard(1)).Return(board); Card cardToAdd = new Card { Id = 1, Title = "Card 1 Updated", LaneId = 1, Description = "some desc 1", TypeId = 1, ExternalCardID = "123" }; Lane affectedLane = new Lane { Id = 1, Title = "Lane 1", Cards = new List<CardView> { new CardView { Id = 1, Title = "Card 1", LaneId = 1, Description = "some desc 1", Type = new CardType {Id = 1, Name = "Card type 1", IconPath = @"C:\"} }, new CardView { Id = 2, Title = "Card 2", LaneId = 1, Description = "some desc 2", Type = new CardType {Id = 1, Name = "Card type 1", IconPath = @"C:\"} }, new CardView { Id = 4, Title = "Card 4", LaneId = 1, Description = "some desc 4", Type = new CardType {Id = 1, Name = "Card type 1", IconPath = @"C:\"} }, }, }; CardAddResult result = new CardAddResult {BoardVersion = 1, CardId = 4, Lane = affectedLane}; _apiMock.Expect(x => x.AddCard(Arg<long>.Is.Anything, Arg<Card>.Is.Anything)).Return(result); _integration = new LeanKitIntegration(1, _apiMock); _integration.ShouldContinue = false; _integration.StartWatching(); _integration.AddCard(cardToAdd); Card card = _integration.GetCard(4); Assert.NotNull(card); Assert.AreEqual("Card 4", card.Title); }
public void CallWillGetCard() { Board board = GetSampleBoard(); _apiMock.Expect(x => x.GetBoard(1)).Return(board); _integration = new LeanKitIntegration(1, _apiMock); _integration.ShouldContinue = false; _integration.StartWatching(); Card card = _integration.GetCard(2); Assert.NotNull(card); Assert.AreEqual("Card 2", card.Title); }