public async Task EnsuresArgumentsNotNull() { var connection = Substitute.For<IApiConnection>(); var client = new PullRequestReviewCommentsClient(connection); string body = "Comment content"; string commitId = "qe3dsdsf6"; string path = "file.css"; int position = 7; var comment = new PullRequestReviewCommentCreate(body, commitId, path, position); await Assert.ThrowsAsync<ArgumentNullException>(() => client.Create(null, "fakeRepoName", 1, comment)); await Assert.ThrowsAsync<ArgumentException>(() => client.Create("", "fakeRepoName", 1, comment)); await Assert.ThrowsAsync<ArgumentNullException>(() => client.Create("fakeOwner", null, 1, comment)); await Assert.ThrowsAsync<ArgumentException>(() => client.Create("fakeOwner", "", 1, comment)); await Assert.ThrowsAsync<ArgumentNullException>(() => client.Create("fakeOwner", "fakeRepoName", 1, null)); }
public void PostsToCorrectUrl() { var connection = Substitute.For<IApiConnection>(); var client = new PullRequestReviewCommentsClient(connection); var comment = new PullRequestReviewCommentCreate("Comment content", "qe3dsdsf6", "file.css", 7); client.Create("fakeOwner", "fakeRepoName", 13, comment); connection.Connection.Received().Post<PullRequestReviewComment>(Arg.Is<Uri>(u => u.ToString() == "repos/fakeOwner/fakeRepoName/pulls/13/comments"), comment, null, null); }