Esempio n. 1
0
            public void PostsToCorrectUrlWithRepositoryId()
            {
                var gitHubClient = Substitute.For <IGitHubClient>();
                var client       = new ObservablePullRequestReviewRequestsClient(gitHubClient);

                IReadOnlyList <string> fakeReviewers = new List <string> {
                    "zxc", "asd"
                };
                var pullRequestReviewRequest = PullRequestReviewRequest.ForReviewers(fakeReviewers);

                client.Create(42, 13, pullRequestReviewRequest);

                gitHubClient.Received().PullRequest.ReviewRequest.Create(42, 13, pullRequestReviewRequest);
            }
Esempio n. 2
0
            public void PostsToCorrectUrl()
            {
                var gitHubClient = Substitute.For <IGitHubClient>();
                var client       = new ObservablePullRequestReviewRequestsClient(gitHubClient);

                IReadOnlyList <string> fakeReviewers = new List <string> {
                    "zxc", "asd"
                };
                var pullRequestReviewRequest = new PullRequestReviewRequest(fakeReviewers);

                client.Create("fakeOwner", "fakeRepoName", 13, pullRequestReviewRequest);

                gitHubClient.Received().PullRequest.ReviewRequest.Create("fakeOwner", "fakeRepoName", 13, pullRequestReviewRequest);
            }
Esempio n. 3
0
            public async Task EnsuresNonNullArguments()
            {
                var gitHubClient = Substitute.For <IGitHubClient>();
                var client       = new ObservablePullRequestReviewRequestsClient(gitHubClient);

                IReadOnlyList <string> fakeReviewers = new List <string> {
                    "zxc", "asd"
                };
                var pullRequestReviewRequest = PullRequestReviewRequest.ForReviewers(fakeReviewers);

                Assert.Throws <ArgumentNullException>(() => client.Create(null, "fakeRepoName", 1, pullRequestReviewRequest));
                Assert.Throws <ArgumentNullException>(() => client.Create("fakeOwner", null, 1, pullRequestReviewRequest));
                Assert.Throws <ArgumentNullException>(() => client.Create("fakeOwner", "fakeRepoName", 1, null));
                Assert.Throws <ArgumentNullException>(() => client.Create(42, 1, null));

                Assert.Throws <ArgumentException>(() => client.Create("", "fakeRepoName", 1, pullRequestReviewRequest));
                Assert.Throws <ArgumentException>(() => client.Create("fakeOwner", "", 1, pullRequestReviewRequest));
            }