public async Task RequestsCorrectUrl()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new PullRequestsClient(connection);

                await client.GetForRepository("fake", "repo");

                connection.Received().GetAll<PullRequest>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/pulls"),
                    Arg.Any<Dictionary<string, string>>());
            }
Пример #2
0
            public async Task RequestsCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new PullRequestsClient(connection);

                await client.GetForRepository("fake", "repo");

                connection.Received().GetAll <PullRequest>(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/pulls"),
                                                           Arg.Any <Dictionary <string, string> >());
            }
Пример #3
0
            public void SendsAppropriateParameters()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new PullRequestsClient(connection);

                client.GetForRepository("fake", "repo", new PullRequestRequest { Head = "user:ref-head", Base = "fake_base_branch"  });

                connection.Received().GetAll<PullRequest>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/pulls"),
                    Arg.Is<Dictionary<string, string>>(d => d.Count == 3
                        && d["head"] == "user:ref-head"
                        && d["state"] == "open"
                        && d["base"] == "fake_base_branch"));
            }
Пример #4
0
            public void SendsAppropriateParameters()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new PullRequestsClient(connection);

                client.GetForRepository("fake", "repo", new PullRequestRequest {
                    Head = "user:ref-head", Base = "fake_base_branch"
                });

                connection.Received().GetAll <PullRequest>(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/pulls"),
                                                           Arg.Is <Dictionary <string, string> >(d => d.Count == 3 &&
                                                                                                 d["head"] == "user:ref-head" &&
                                                                                                 d["state"] == "open" &&
                                                                                                 d["base"] == "fake_base_branch"));
            }