public void PostsToCorrectUrl() { var connection = Substitute.For<IApiConnection>(); var client = new PullRequestReviewCommentsClient(connection); var comment = new PullRequestReviewCommentEdit("New comment content"); client.Edit("fakeOwner", "fakeRepoName", 13, comment); connection.Received().Patch<PullRequestReviewComment>(Arg.Is<Uri>(u => u.ToString() == "repos/fakeOwner/fakeRepoName/pulls/comments/13"), comment); }
public async Task EnsuresArgumentsNotNull() { var connection = Substitute.For<IApiConnection>(); var client = new PullRequestReviewCommentsClient(connection); var body = "New comment content"; var comment = new PullRequestReviewCommentEdit(body); await Assert.ThrowsAsync<ArgumentNullException>(() => client.Edit(null, "fakeRepoName", 1, comment)); await Assert.ThrowsAsync<ArgumentException>(() => client.Edit("", "fakeRepoName", 1, comment)); await Assert.ThrowsAsync<ArgumentNullException>(() => client.Edit("fakeOwner", null, 1, comment)); await Assert.ThrowsAsync<ArgumentException>(() => client.Edit("fakeOwner", "", 1, comment)); await Assert.ThrowsAsync<ArgumentNullException>(() => client.Edit("fakeOwner", null, 1, null)); }
public async Task PostsToCorrectUrlWithRepositoryId() { var connection = Substitute.For<IApiConnection>(); var client = new PullRequestReviewCommentsClient(connection); var comment = new PullRequestReviewCommentEdit("New comment content"); await client.Edit(1, 13, comment); connection.Received().Patch<PullRequestReviewComment>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/pulls/comments/13"), comment); }