public GetAllForIssue ( long repositoryId, int number ) : IObservable |
||
repositoryId | long | The Id of the repository |
number | int | The issue number |
return | IObservable |
public void RequestsCorrectUrl() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableIssueCommentsClient(gitHubClient); client.GetAllForIssue("fake", "repo", 3); gitHubClient.Connection.Received(1).Get<List<IssueComment>>( new Uri("repos/fake/repo/issues/3/comments", UriKind.Relative), null, null); }
public async Task EnsuresNonNullArguments() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableIssueCommentsClient(gitHubClient); Assert.Throws<ArgumentNullException>(() => client.GetAllForIssue(null, "name", 1)); Assert.Throws<ArgumentNullException>(() => client.GetAllForIssue("owner", null, 1)); Assert.Throws<ArgumentNullException>(() => client.GetAllForIssue(null, "name", 1, ApiOptions.None)); Assert.Throws<ArgumentNullException>(() => client.GetAllForIssue("owner", null, 1, ApiOptions.None)); Assert.Throws<ArgumentNullException>(() => client.GetAllForIssue("owner", "name", 1, null)); Assert.Throws<ArgumentNullException>(() => client.GetAllForIssue(1, 1, null)); Assert.Throws<ArgumentException>(() => client.GetAllForIssue("", "name", 1)); Assert.Throws<ArgumentException>(() => client.GetAllForIssue("owner", "", 1)); Assert.Throws<ArgumentException>(() => client.GetAllForIssue("", "name", 1, ApiOptions.None)); Assert.Throws<ArgumentException>(() => client.GetAllForIssue("owner", "", 1, ApiOptions.None)); }
public void RequestsCorrectUrlWithRepositoryIdWithApiOptions() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableIssueCommentsClient(gitHubClient); var options = new ApiOptions { StartPage = 1, PageSize = 1, PageCount = 1 }; client.GetAllForIssue(1, 3, options); gitHubClient.Connection.Received(1).Get<List<IssueComment>>( new Uri("repositories/1/issues/3/comments", UriKind.Relative), Arg.Is<IDictionary<string, string>>(d => d.Count == 2), null); }
public void RequestsCorrectUrlWithApiOptions() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableIssueCommentsClient(gitHubClient); var options = new ApiOptions { StartPage = 1, PageSize = 1, PageCount = 1 }; client.GetAllForIssue("fake", "repo", 3, options); gitHubClient.Connection.Received(1).Get<List<IssueComment>>( new Uri("repos/fake/repo/issues/3/comments", UriKind.Relative), Arg.Is<IDictionary<string, string>>(d => d.Count == 2), "application/vnd.github.squirrel-girl-preview"); }
public void RequestsCorrectUrlWithRepositoryId() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableIssueCommentsClient(gitHubClient); client.GetAllForIssue(1, 3); gitHubClient.Connection.Received(1).Get<List<IssueComment>>( new Uri("repositories/1/issues/3/comments", UriKind.Relative), Args.EmptyDictionary, null); }
public void RequestsCorrectUrl() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableIssueCommentsClient(gitHubClient); client.GetAllForIssue("fake", "repo", 3); gitHubClient.Connection.Received(1).Get<List<IssueComment>>( new Uri("repos/fake/repo/issues/3/comments", UriKind.Relative), Args.EmptyDictionary, "application/vnd.github.squirrel-girl-preview"); }
public async Task EnsuresArgumentsNotNull() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableIssueCommentsClient(gitHubClient); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllForIssue(null, "name", 1).ToTask()); await Assert.ThrowsAsync<ArgumentException>(() => client.GetAllForIssue("", "name", 1).ToTask()); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllForIssue("owner", null, 1).ToTask()); await Assert.ThrowsAsync<ArgumentException>(() => client.GetAllForIssue("owner", "", 1).ToTask()); }