public async Task EnsuresArgumentsNotNull() { var connection = Substitute.For<IApiConnection>(); var client = new PullRequestReviewCommentsClient(connection); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAll(null, "name", 1)); await Assert.ThrowsAsync<ArgumentException>(() => client.GetAll("", "name", 1)); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAll("owner", null, 1)); await Assert.ThrowsAsync<ArgumentException>(() => client.GetAll("owner", "", 1)); }
public void RequestsCorrectUrl() { var connection = Substitute.For<IApiConnection>(); var client = new PullRequestReviewCommentsClient(connection); client.GetAll("fakeOwner", "fakeRepoName", 7); connection.Received().GetAll<PullRequestReviewComment>(Arg.Is<Uri>(u => u.ToString() == "repos/fakeOwner/fakeRepoName/pulls/7/comments")); }
public async Task RequestsCorrectUrl() { var connection = Substitute.For<IApiConnection>(); var client = new PullRequestReviewCommentsClient(connection); await client.GetAll("owner", "name", 7); connection.Received().GetAll<PullRequestReviewComment>( Arg.Is<Uri>(u => u.ToString() == "repos/owner/name/pulls/7/comments"), Arg.Any<Dictionary<string, string>>(), "application/vnd.github.squirrel-girl-preview", Args.ApiOptions); }
public async Task RequestsCorrectUrlWithApiOptions() { var connection = Substitute.For<IApiConnection>(); var client = new PullRequestReviewCommentsClient(connection); var options = new ApiOptions { StartPage = 1, PageCount = 1, PageSize = 1 }; await client.GetAll("fakeOwner", "fakeRepoName", 7, options); connection.Received().GetAll<PullRequestReviewComment>( Arg.Is<Uri>(u => u.ToString() == "repos/fakeOwner/fakeRepoName/pulls/7/comments"), options); }
public async Task RequestsCorrectUrlWithRepositoryId() { var connection = Substitute.For<IApiConnection>(); var client = new PullRequestReviewCommentsClient(connection); await client.GetAll(1, 7); connection.Received().GetAll<PullRequestReviewComment>( Arg.Is<Uri>(u => u.ToString() == "repositories/1/pulls/7/comments"), Args.ApiOptions); }