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