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