Ejemplo n.º 1
0
            public async Task EnsuresArgumentsNotNull()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new PullRequestsClient(connection);

                AssertEx.Throws <ArgumentNullException>(async() => await
                                                        client.Merge(null, "name", 42, new MergePullRequest("message")));
                AssertEx.Throws <ArgumentException>(async() => await
                                                    client.Merge("owner", null, 42, new MergePullRequest("message")));
                AssertEx.Throws <ArgumentNullException>(async() => await
                                                        client.Merge("owner", "name", 42, null));
            }
            public async Task EnsuresArgumentsNotNull()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new PullRequestsClient(connection);

                await Assert.ThrowsAsync <ArgumentNullException>(() =>
                                                                 client.Merge(null, "name", 42, new MergePullRequest {
                    CommitMessage = "message"
                }));

                await Assert.ThrowsAsync <ArgumentNullException>(() =>
                                                                 client.Merge("owner", null, 42, new MergePullRequest {
                    CommitMessage = "message"
                }));

                await Assert.ThrowsAsync <ArgumentNullException>(() =>
                                                                 client.Merge("owner", "name", 42, null));
            }
Ejemplo n.º 3
0
            public void PutsToCorrectUrl()
            {
                var mergePullRequest = new MergePullRequest("fake commit message");
                var connection       = Substitute.For <IApiConnection>();
                var client           = new PullRequestsClient(connection);

                client.Merge("fake", "repo", 42, mergePullRequest);

                connection.Received().Put <PullRequestMerge>(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/pulls/42/merge"),
                                                             mergePullRequest);
            }
Ejemplo n.º 4
0
            public void PutsToCorrectUrlWithRepositoryId()
            {
                var mergePullRequest = new MergePullRequest {
                    CommitMessage = "fake commit message"
                };
                var connection = Substitute.For <IApiConnection>();
                var client     = new PullRequestsClient(connection);

                client.Merge(1, 42, mergePullRequest);

                connection.Received()
                .Put <PullRequestMerge>(Arg.Is <Uri>(u => u.ToString() == "repositories/1/pulls/42/merge"), mergePullRequest);
            }
            public void PutsToCorrectUrl()
            {
                var mergePullRequest = new MergePullRequest {
                    CommitMessage = "fake commit message"
                };
                var connection = Substitute.For <IApiConnection>();
                var client     = new PullRequestsClient(connection);

                client.Merge("fake", "repo", 42, mergePullRequest);

                connection.Received().Put <PullRequestMerge>(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/pulls/42/merge"),
                                                             mergePullRequest, null, "application/vnd.github.polaris-preview+json");
            }
            public async Task EnsuresArgumentsNotNull()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new PullRequestsClient(connection);

                await Assert.ThrowsAsync<ArgumentNullException>(() =>
                    client.Merge(null, "name", 42, new MergePullRequest { CommitMessage = "message" }));
                await Assert.ThrowsAsync<ArgumentNullException>(() =>
                    client.Merge("owner", null, 42, new MergePullRequest { CommitMessage = "message" }));
                await Assert.ThrowsAsync<ArgumentNullException>(() =>
                    client.Merge("owner", "name", 42, null));
            }
            public void PutsToCorrectUrl() 
            {
                var mergePullRequest = new MergePullRequest("fake commit message");
                var connection = Substitute.For<IApiConnection>();
                var client = new PullRequestsClient(connection);

                client.Merge("fake", "repo", 42, mergePullRequest);

                connection.Received().Put<PullRequestMerge>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/pulls/42/merge"),
                    mergePullRequest);
            }
            public void PutsToCorrectUrl()
            {
                var mergePullRequest = new MergePullRequest { CommitMessage = "fake commit message" };
                var connection = Substitute.For<IApiConnection>();
                var client = new PullRequestsClient(connection);

                client.Merge("fake", "repo", 42, mergePullRequest);

                connection.Received().Put<PullRequestMerge>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/pulls/42/merge"),
                    mergePullRequest,null, "application/vnd.github.polaris-preview+json");
            }
            public async Task EnsuresArgumentsNotNull()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new PullRequestsClient(connection);

                await AssertEx.Throws<ArgumentNullException>(async () => await
                    client.Merge(null, "name", 42, new MergePullRequest("message")));
                await AssertEx.Throws<ArgumentNullException>(async () => await
                    client.Merge("owner", null, 42, new MergePullRequest("message")));
                await AssertEx.Throws<ArgumentNullException>(async () => await
                    client.Merge("owner", "name", 42, null));
            }