public void It_should_call_leankit_multiple_times_to_create_card_if_there_are_multiple_issues() { _mapping.Identity.LeanKit = 3; _mapping.Identity.Target = "3"; ((TestGitHubIssues)TestItem).Syncronize(_mapping); MockRestClient.Verify(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("/3/issues") && y.Method == Method.GET)), Times.Exactly(_mapping.QueryStates.Count)); MockLeanKitApi.Verify(x => x.AddCard(3, It.IsAny <Card>(), It.IsAny <string>()), Times.Exactly(3)); }
public void It_should_call_leankit_to_create_card_if_card_with_externalid_exists_but_different_externalsystemname() { _mapping.Identity.LeanKit = 5; _mapping.Identity.Target = "5"; ((TestGitHubIssues)TestItem).Syncronize(_mapping); MockRestClient.Verify(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("/5/issues") && y.Method == Method.GET)), Times.Exactly(_mapping.QueryStates.Count)); MockLeanKitApi.Verify(x => x.AddCard(5, It.IsAny <Card>(), It.IsAny <string>()), Times.Exactly(1)); }
public void It_should_call_unfuddle_to_get_list_of_tickets() { _mapping.Identity.LeanKit = 1; _mapping.Identity.Target = "1"; ((TestUnfuddle)TestItem).Syncronize(_mapping); MockRestClient.Verify(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("projects/1/ticket_reports") && y.Method == Method.GET)), Times.Exactly(1)); MockLeanKitApi.Verify(x => x.AddCard(1, It.IsAny <Card>(), It.IsAny <string>()), Times.Exactly(1)); }
public void It_should_call_github_to_get_list_of_issues() { _mapping.Identity.LeanKit = 1; _mapping.Identity.Target = "1"; ((TestGitHubIssues)TestItem).Syncronize(_mapping); MockRestClient.Verify(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("/1/issues") && y.Method == Method.GET)), Times.Exactly(_mapping.QueryStates.Count)); MockLeanKitApi.Verify(x => x.AddCard(1, It.IsAny <Card>(), It.IsAny <string>()), Times.Exactly(1)); }
public void It_should_call_leankit_multiple_times_to_create_card_if_there_are_multiple_tickets() { _mapping.Identity.LeanKit = 3; _mapping.Identity.Target = "3"; ((TestUnfuddle)TestItem).Syncronize(_mapping); MockRestClient.Verify(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("projects/3/ticket_reports") && y.Method == Method.GET)), Times.Exactly(1)); MockLeanKitApi.Verify(x => x.AddCard(3, It.IsAny <Card>(), It.IsAny <string>()), Times.Exactly(3)); }
public void It_should_not_call_leankit_to_create_card_if_card_with_externalid_already_exists() { _mapping.Identity.LeanKit = 4; _mapping.Identity.Target = "4"; ((TestUnfuddle)TestItem).Syncronize(_mapping); MockRestClient.Verify(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("projects/4/ticket_reports") && y.Method == Method.GET)), Times.Exactly(1)); MockLeanKitApi.Verify(x => x.AddCard(4, It.IsAny <Card>(), It.IsAny <string>()), Times.Never()); }
public void It_should_call_leankit_create_card_if_card_with_externalid_exists_but_has_different_externalsystemname() { _mapping.Identity.LeanKit = 5; _mapping.Identity.Target = "5"; ((TestUnfuddle)TestItem).Syncronize(_mapping); MockRestClient.Verify(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("projects/5/ticket_reports") && y.Method == Method.GET)), Times.Exactly(1)); MockLeanKitApi.Verify(x => x.AddCard(5, It.IsAny <Card>(), It.IsAny <string>()), Times.Exactly(1)); }
public void It_should_call_leankit_to_create_card_if_existing_card_has_externalid_but_externalsystemname_does_not_match() { _mapping.Identity.LeanKit = 5; _mapping.Identity.Target = "5"; ((TestGitHubPulls)TestItem).Syncronize(_mapping); MockRestClient.Verify(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("/5/pulls") && y.Method == Method.GET)), Times.Exactly(1)); MockLeanKitApi.Verify(x => x.AddCard(5, It.IsAny <Card>(), It.IsAny <string>()), Times.Exactly(1)); }
public void It_should_call_leankit_once_to_create_card_if_there_is_one_pullrequest() { _mapping.Identity.LeanKit = 2; _mapping.Identity.Target = "2"; ((TestGitHubPulls)TestItem).Syncronize(_mapping); MockRestClient.Verify(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("/2/pulls") && y.Method == Method.GET)), Times.Exactly(1)); MockLeanKitApi.Verify(x => x.AddCard(2, It.IsAny <Card>(), It.IsAny <string>()), Times.Exactly(1)); }
protected override void OnArrange() { base.OnArrange(); MockLeanKitApi.Setup(x => x.GetBoard(It.IsAny <long>())).Returns(_testBoard); var serializer = new JsonSerializer <Unfuddle.Person>(); var user1 = new Unfuddle.Person() { Email = "*****@*****.**", First_Name = "Johnny", Id = 1, Last_Name = "Cash", Username = "******" }; var user2 = new Unfuddle.Person() { Email = "*****@*****.**", First_Name = "Willy", Id = 2, Last_Name = "Cash", Username = "******" }; var user3 = new Unfuddle.Person() { Email = "", First_Name = "", Id = 3, Last_Name = "", Username = "" }; var restResponse1 = new RestResponse() { Content = serializer.SerializeToString(user1), StatusCode = HttpStatusCode.OK }; var restResponse2 = new RestResponse() { Content = serializer.SerializeToString(user2), StatusCode = HttpStatusCode.OK }; var restResponse3 = new RestResponse() { Content = serializer.SerializeToString(user3), StatusCode = HttpStatusCode.OK }; MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("people/1")))).Returns(restResponse1); MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("people/2")))).Returns(restResponse2); MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("people/3")))).Returns(restResponse3); }
protected override void OnArrange() { base.OnArrange(); MockLeanKitApi.Setup(x => x.GetBoard(It.IsAny <long>())).Returns(_testBoard); var serializer = new JsonSerializer <GitHubIssues.Issue>(); var issue1 = new GitHubIssues.Issue() { Id = 1, Number = 1, State = "Open" }; var restResponse1 = new RestResponse() { Content = serializer.SerializeToString(issue1), StatusCode = HttpStatusCode.OK }; MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("issues/1") && y.Method == Method.GET))).Returns(restResponse1); MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("issues/1") && y.Method == Method.PATCH))).Returns(restResponse1); var issue2 = new GitHubIssues.Issue() { Id = 2, Number = 2, State = "Closed" }; var restResponse2 = new RestResponse() { Content = serializer.SerializeToString(issue2), StatusCode = HttpStatusCode.OK }; MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("issues/2") && y.Method == Method.GET))).Returns(restResponse2); MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("issues/2") && y.Method == Method.PATCH))).Returns(restResponse2); var errorSerializer = new JsonSerializer <GitHubIssues.ErrorMessage>(); var errorResponse = new RestResponse() { Content = errorSerializer.SerializeToString(new GitHubIssues.ErrorMessage() { Message = "Error" }), StatusCode = HttpStatusCode.NotFound }; MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("issues/3") && y.Method == Method.GET))).Returns(errorResponse); MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("issues/3") && y.Method == Method.PATCH))).Returns(errorResponse); }
protected override void OnArrange() { base.OnArrange(); MockLeanKitApi.Setup(x => x.GetBoard(It.IsAny <long>())).Returns(_testBoard); }
protected override void OnArrange() { base.OnArrange(); MockLeanKitApi.Setup(x => x.GetBoard(It.IsAny <long>())).Returns(_testBoard); var serializer = new JsonSerializer <Unfuddle.TicketsResponse>(); var ticket1 = new Unfuddle.Ticket() { Id = 1, Status = "Open", Description = "Ticket 1", Summary = "Ticket 1" }; var ticket2 = new Unfuddle.Ticket() { Id = 2, Status = "Open", Description = "Ticket 2", Summary = "Ticket 2" }; var ticket3 = new Unfuddle.Ticket() { Id = 3, Status = "Open", Description = "Ticket 3", Summary = "Ticket 3" }; var group1 = new Unfuddle.Group() { Tickets = new List <Unfuddle.Ticket>() { ticket1 } }; var unfuddleResponse1 = new Unfuddle.TicketsResponse() { Count = 1, Groups = new List <Unfuddle.Group>() { group1 } }; var restResponse1 = new RestResponse() { Content = serializer.SerializeToString(unfuddleResponse1), StatusCode = HttpStatusCode.OK }; MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("projects/1/ticket_reports") && y.Method == Method.GET))).Returns(restResponse1); MockLeanKitApi.Setup(x => x.GetCardByExternalId(1, It.IsAny <string>())).Returns((Card)null); MockLeanKitApi.Setup(x => x.AddCard(1, It.IsAny <Card>(), It.IsAny <string>())).Returns(_testCardAddResult1); MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("projects/2/ticket_reports") && y.Method == Method.GET))).Returns(restResponse1); MockLeanKitApi.Setup(x => x.GetCardByExternalId(2, It.IsAny <string>())).Returns((Card)null); MockLeanKitApi.Setup(x => x.AddCard(2, It.IsAny <Card>(), It.IsAny <string>())).Returns(_testCardAddResult1); var group3 = new Unfuddle.Group() { Tickets = new List <Unfuddle.Ticket>() { ticket1, ticket2, ticket3 } }; var unfuddleResponse3 = new Unfuddle.TicketsResponse() { Count = 1, Groups = new List <Unfuddle.Group>() { group3 } }; var restResponse3 = new RestResponse() { Content = serializer.SerializeToString(unfuddleResponse3), StatusCode = HttpStatusCode.OK }; MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("projects/3/ticket_reports") && y.Method == Method.GET))).Returns(restResponse3); MockLeanKitApi.Setup(x => x.GetCardByExternalId(3, It.IsAny <string>())).Returns((Card)null); MockLeanKitApi.Setup(x => x.AddCard(3, It.IsAny <Card>(), It.IsAny <string>())).Returns(_testCardAddResult1); MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("projects/4/ticket_reports") && y.Method == Method.GET))).Returns(restResponse1); MockLeanKitApi.Setup(x => x.GetCardByExternalId(4, It.IsAny <string>())).Returns(new Card() { Id = 4, ExternalSystemName = "Unfuddle" }); MockLeanKitApi.Setup(x => x.AddCard(4, It.IsAny <Card>(), It.IsAny <string>())).Returns(_testCardAddResult1); MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("projects/5/ticket_reports") && y.Method == Method.GET))).Returns(restResponse1); MockLeanKitApi.Setup(x => x.GetCardByExternalId(5, It.IsAny <string>())).Returns(new Card() { Id = 4, ExternalSystemName = "Unfuddlest" }); MockLeanKitApi.Setup(x => x.AddCard(5, It.IsAny <Card>(), It.IsAny <string>())).Returns(_testCardAddResult1); }
protected override void OnArrange() { base.OnArrange(); MockLeanKitApi.Setup(x => x.GetBoard(It.IsAny <long>())).Returns(_testBoard); var serializer = new JsonSerializer <Unfuddle.Ticket>(); var ticket1 = new Unfuddle.Ticket() { Id = 1, Status = "Open" }; var restResponse1 = new RestResponse() { Content = serializer.SerializeToString(ticket1), StatusCode = HttpStatusCode.OK }; MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("tickets/1") && y.Method == Method.GET))).Returns(restResponse1); MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("tickets/1") && y.Method == Method.PUT))).Returns(restResponse1); var ticket2 = new Unfuddle.Ticket() { Id = 2, Status = "Accepted" }; var restResponse2 = new RestResponse() { Content = serializer.SerializeToString(ticket2), StatusCode = HttpStatusCode.OK }; MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("tickets/2") && y.Method == Method.GET))).Returns(restResponse2); MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("tickets/2") && y.Method == Method.PUT))).Returns(restResponse2); var ticket3 = new Unfuddle.Ticket() { Id = 3, Status = "Open" }; var restResponse3 = new RestResponse() { Content = serializer.SerializeToString(ticket3), StatusCode = HttpStatusCode.OK }; MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("tickets/3") && y.Method == Method.GET))).Returns(restResponse3); MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("tickets/3") && y.Method == Method.PUT))).Returns(restResponse3); var ticket4 = new Unfuddle.Ticket() { Id = 4, Status = "Resolved" }; var restResponse4 = new RestResponse() { Content = serializer.SerializeToString(ticket4), StatusCode = HttpStatusCode.OK }; MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("tickets/4") && y.Method == Method.GET))).Returns(restResponse4); MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("tickets/4") && y.Method == Method.PUT))).Returns(restResponse4); }
public void It_should_get_board_for_each_mapping() { MockLeanKitApi.Verify(x => x.GetBoard(It.IsAny <long>()), Times.Exactly(TestConfig.Mappings.Count)); }
protected override void OnArrange() { base.OnArrange(); MockLeanKitApi.Setup(x => x.GetBoard(It.IsAny <int>())).Returns(new Board()); }
protected override void OnArrange() { base.OnArrange(); MockLeanKitApi.Setup(x => x.GetBoard(It.IsAny <long>())).Returns(_testBoard); var serializer = new JsonSerializer <List <GitHubPulls.Pull> >(); var pull1 = new GitHubPulls.Pull() { Id = 1, Number = 1, State = "Open", Body = "New Pull 1", Title = "New Pull 1" }; var pull2 = new GitHubPulls.Pull() { Id = 2, Number = 2, State = "Open", Body = "New Pull 2", Title = "New Pull 2" }; var pull3 = new GitHubPulls.Pull() { Id = 3, Number = 3, State = "Open", Body = "New Pull 3", Title = "New Pull 3" }; var restResponse1 = new RestResponse() { Content = serializer.SerializeToString(new List <GitHubPulls.Pull>() { pull1 }), StatusCode = HttpStatusCode.OK }; MockRestClient.Setup( x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("/1/pulls") && y.Method == Method.GET))) .Returns(restResponse1); MockLeanKitApi.Setup(x => x.GetCardByExternalId(1, It.IsAny <string>())).Returns((Card)null); MockLeanKitApi.Setup(x => x.AddCard(1, It.IsAny <Card>(), It.IsAny <string>())).Returns(_testCardAddResult1); MockRestClient.Setup( x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("/2/pulls") && y.Method == Method.GET))) .Returns(restResponse1); MockLeanKitApi.Setup(x => x.GetCardByExternalId(2, It.IsAny <string>())).Returns((Card)null); MockLeanKitApi.Setup(x => x.AddCard(2, It.IsAny <Card>(), It.IsAny <string>())).Returns(_testCardAddResult1); var restResponse3 = new RestResponse() { Content = serializer.SerializeToString(new List <GitHubPulls.Pull>() { pull1, pull2, pull3 }), StatusCode = HttpStatusCode.OK }; MockRestClient.Setup( x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("/3/pulls") && y.Method == Method.GET))) .Returns(restResponse3); MockLeanKitApi.Setup(x => x.GetCardByExternalId(3, It.IsAny <string>())).Returns((Card)null); MockLeanKitApi.Setup(x => x.AddCard(3, It.IsAny <Card>(), It.IsAny <string>())).Returns(_testCardAddResult1); MockRestClient.Setup( x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("/4/pulls") && y.Method == Method.GET))) .Returns(restResponse1); MockLeanKitApi.Setup(x => x.GetCardByExternalId(4, It.IsAny <string>())) .Returns(new Card() { Id = 4, ExternalSystemName = "GitHub" }); MockLeanKitApi.Setup(x => x.AddCard(4, It.IsAny <Card>(), It.IsAny <string>())).Returns(_testCardAddResult1); MockRestClient.Setup( x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("/5/pulls") && y.Method == Method.GET))) .Returns(restResponse1); MockLeanKitApi.Setup(x => x.GetCardByExternalId(5, It.IsAny <string>())) .Returns(new Card() { Id = 5, ExternalSystemName = "GitHubber" }); MockLeanKitApi.Setup(x => x.AddCard(5, It.IsAny <Card>(), It.IsAny <string>())).Returns(_testCardAddResult1); }
protected override void OnArrange() { base.OnArrange(); MockLeanKitApi.Setup(x => x.GetBoard(It.IsAny <long>())).Returns(_testBoard); var serializer = new JsonSerializer <GitHubIssues.Issue>(); var issue1 = new GitHubIssues.Issue() { Id = 1, Number = 1, Title = "Issue 1", Body = "Issue 1", State = "Open" }; var restResponse1 = new RestResponse() { Content = serializer.SerializeToString(issue1), StatusCode = HttpStatusCode.OK }; MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("issues/1") && y.Method == Method.GET))).Returns(restResponse1); MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("issues/1") && y.Method == Method.PATCH))).Returns(restResponse1); var issue2 = new GitHubIssues.Issue() { Id = 2, Number = 2, Title = "Issue 2", Body = "Issue 2", State = "Open" }; var restResponse2 = new RestResponse() { Content = serializer.SerializeToString(issue2), StatusCode = HttpStatusCode.OK }; MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("issues/2") && y.Method == Method.GET))).Returns(restResponse2); MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("issues/2") && y.Method == Method.PATCH))).Returns(restResponse2); var issue3 = new GitHubIssues.Issue() { Id = 3, Number = 3, Title = "Issue 3", Body = "Issue 3", State = "Open" }; var restResponse3 = new RestResponse() { Content = serializer.SerializeToString(issue3), StatusCode = HttpStatusCode.OK }; MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("issues/3") && y.Method == Method.GET))).Returns(restResponse3); MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("issues/3") && y.Method == Method.PATCH))).Returns(restResponse3); var issue4 = new GitHubIssues.Issue() { Id = 4, Number = 4, Title = "Issue 4", Body = "Issue 4", State = "Open" }; var restResponse4 = new RestResponse() { Content = serializer.SerializeToString(issue4), StatusCode = HttpStatusCode.OK }; MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("issues/4") && y.Method == Method.GET))).Returns(restResponse4); MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("issues/4") && y.Method == Method.PATCH))).Returns(restResponse4); }
protected override void OnArrange() { base.OnArrange(); MockLeanKitApi.Setup(x => x.GetBoard(It.IsAny <long>())).Returns(_testBoard); var serializer = new JsonSerializer <List <GitHubIssues.Issue> >(); var issue1 = new GitHubIssues.Issue() { Id = 1, Number = 1, State = "Open", Body = "New Issue 1", Title = "New Issue 1" }; var issue2 = new GitHubIssues.Issue() { Id = 2, Number = 2, State = "Open", Body = "New Issue 2", Title = "New Issue 2" }; var issue3 = new GitHubIssues.Issue() { Id = 3, Number = 3, State = "Open", Body = "New Issue 3", Title = "New Issue 3" }; var restResponse1 = new RestResponse() { Content = serializer.SerializeToString(new List <GitHubIssues.Issue>() { issue1 }), StatusCode = HttpStatusCode.OK }; var noRestResponse = new RestResponse() { StatusCode = HttpStatusCode.OK, Content = "" }; MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("/1/issues") && y.Method == Method.GET && y.Parameters[0].Value.ToString() == "Open"))).Returns(restResponse1); MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("/1/issues") && y.Method == Method.GET && y.Parameters[0].Value.ToString() != "Open"))).Returns(noRestResponse); MockLeanKitApi.Setup(x => x.GetCardByExternalId(1, It.IsAny <string>())).Returns((Card)null); MockLeanKitApi.Setup(x => x.AddCard(1, It.IsAny <Card>(), It.IsAny <string>())).Returns(_testCardAddResult1); MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("/2/issues") && y.Method == Method.GET && y.Parameters[0].Value.ToString() == "Open"))).Returns(restResponse1); MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("/2/issues") && y.Method == Method.GET && y.Parameters[0].Value.ToString() != "Open"))).Returns(noRestResponse); MockLeanKitApi.Setup(x => x.GetCardByExternalId(2, It.IsAny <string>())).Returns((Card)null); MockLeanKitApi.Setup(x => x.AddCard(2, It.IsAny <Card>(), It.IsAny <string>())).Returns(_testCardAddResult1); var restResponse3 = new RestResponse() { Content = serializer.SerializeToString(new List <GitHubIssues.Issue>() { issue1, issue2, issue3 }), StatusCode = HttpStatusCode.OK }; MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("/3/issues") && y.Method == Method.GET && y.Parameters[0].Value.ToString() == "Open"))).Returns(restResponse3); MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("/3/issues") && y.Method == Method.GET && y.Parameters[0].Value.ToString() != "Open"))).Returns(noRestResponse); MockLeanKitApi.Setup(x => x.GetCardByExternalId(3, It.IsAny <string>())).Returns((Card)null); MockLeanKitApi.Setup(x => x.AddCard(3, It.IsAny <Card>(), It.IsAny <string>())).Returns(_testCardAddResult1); MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("/4/issues") && y.Method == Method.GET && y.Parameters[0].Value.ToString() == "Open"))).Returns(restResponse1); MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("/4/issues") && y.Method == Method.GET && y.Parameters[0].Value.ToString() != "Open"))).Returns(noRestResponse); MockLeanKitApi.Setup(x => x.GetCardByExternalId(4, It.IsAny <string>())).Returns(new Card() { Id = 4, ExternalSystemName = "GitHub" }); MockLeanKitApi.Setup(x => x.AddCard(4, It.IsAny <Card>(), It.IsAny <string>())).Returns(_testCardAddResult1); MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("/5/issues") && y.Method == Method.GET && y.Parameters[0].Value.ToString() == "Open"))).Returns(restResponse1); MockRestClient.Setup(x => x.Execute(It.Is <RestRequest>(y => y.Resource.Contains("/5/issues") && y.Method == Method.GET && y.Parameters[0].Value.ToString() != "Open"))).Returns(noRestResponse); MockLeanKitApi.Setup(x => x.GetCardByExternalId(5, It.IsAny <string>())).Returns(new Card() { Id = 4, ExternalSystemName = "GitHubby" }); MockLeanKitApi.Setup(x => x.AddCard(5, It.IsAny <Card>(), It.IsAny <string>())).Returns(_testCardAddResult1); }