public void EnsuresNonNullArguments() { var client = new ObservablePullRequestReviewsClient(Substitute.For <IGitHubClient>()); string body = "Comment content"; string path = "file.css"; int position = 7; var comment = new DraftPullRequestReviewComment(body, path, position); var review = new PullRequestReviewCreate() { CommitId = "commit", Body = "body", Event = PullRequestReviewEvent.Approve }; review.Comments.Add(comment); Assert.Throws <ArgumentNullException>(() => client.Create(null, "fakeRepoName", 1, review)); Assert.Throws <ArgumentNullException>(() => client.Create("fakeOwner", null, 1, review)); Assert.Throws <ArgumentNullException>(() => client.Create("fakeOwner", "fakeRepoName", 1, null)); Assert.Throws <ArgumentException>(() => client.Create("", "fakeRepoName", 1, review)); Assert.Throws <ArgumentException>(() => client.Create("fakeOwner", "", 1, review)); }
public void PostsToCorrectUrlWithRepositoryId() { var gitHubClient = Substitute.For <IGitHubClient>(); var client = new ObservablePullRequestReviewsClient(gitHubClient); var comment = new DraftPullRequestReviewComment("Comment content", "file.css", 7); var review = new PullRequestReviewCreate() { CommitId = "commit", Body = "body", Event = PullRequestReviewEvent.Approve }; review.Comments.Add(comment); client.Create(1, 13, review); gitHubClient.Received().PullRequest.Review.Create(1, 53, review); }