public GetAllForRepository ( long repositoryId ) : IObservable |
||
repositoryId | long | The Id of the repository |
return | IObservable |
public async Task EnsuresArgumentsNotNull() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableIssueCommentsClient(gitHubClient); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllForRepository(null, "name").ToTask()); await Assert.ThrowsAsync<ArgumentException>(() => client.GetAllForRepository("", "name").ToTask()); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllForRepository("owner", null).ToTask()); await Assert.ThrowsAsync<ArgumentException>(() => client.GetAllForRepository("owner", "").ToTask()); }
public void RequestsCorrectUrlWithRepositoryId() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableIssueCommentsClient(gitHubClient); client.GetAllForRepository(1); gitHubClient.Connection.Received(1).Get<List<IssueComment>>( new Uri("repositories/1/issues/comments", UriKind.Relative), Args.EmptyDictionary, null); }
public void RequestsCorrectUrl() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableIssueCommentsClient(gitHubClient); client.GetAllForRepository("fake", "repo"); gitHubClient.Connection.Received(1).Get<List<IssueComment>>( new Uri("repos/fake/repo/issues/comments", UriKind.Relative), null, null); }
public void RequestsCorrectUrl() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableIssueCommentsClient(gitHubClient); client.GetAllForRepository("fake", "repo"); gitHubClient.Connection.Received(1).Get<List<IssueComment>>( new Uri("repos/fake/repo/issues/comments", UriKind.Relative), Args.EmptyDictionary, "application/vnd.github.squirrel-girl-preview"); }
public void RequestsCorrectUrlWithRepositoryId() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableIssueCommentsClient(gitHubClient); client.GetAllForRepository(1); gitHubClient.Connection.Received(1).Get<List<IssueComment>>( new Uri("repositories/1/issues/comments", UriKind.Relative), Arg.Any<IDictionary<string, string>>(), "application/vnd.github.squirrel-girl-preview"); }
public void RequestsCorrectUrlWithApiOptions() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableIssueCommentsClient(gitHubClient); var options=new ApiOptions { StartPage = 1, PageSize = 1, PageCount = 1 }; client.GetAllForRepository("fake", "repo", options); gitHubClient.Connection.Received(1).Get<List<IssueComment>>( new Uri("repos/fake/repo/issues/comments", UriKind.Relative), Arg.Any<Dictionary<string, string>>(), "application/vnd.github.squirrel-girl-preview"); }
public void RequestsCorrectUrlWithRepositoryIdWithApiOptions() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableIssueCommentsClient(gitHubClient); var options = new ApiOptions { StartPage = 1, PageSize = 1, PageCount = 1 }; client.GetAllForRepository(1, options); gitHubClient.Connection.Received(1).Get<List<IssueComment>>( new Uri("repositories/1/issues/comments", UriKind.Relative), Arg.Is<IDictionary<string, string>>(d => d.Count == 2), null); }
public async Task EnsuresNonNullArguments() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableIssueCommentsClient(gitHubClient); Assert.Throws<ArgumentNullException>(() => client.GetAllForRepository(null, "name")); Assert.Throws<ArgumentNullException>(() => client.GetAllForRepository("owner", null)); Assert.Throws<ArgumentNullException>(() => client.GetAllForRepository(null, "name", ApiOptions.None)); Assert.Throws<ArgumentNullException>(() => client.GetAllForRepository("owner", null, ApiOptions.None)); Assert.Throws<ArgumentNullException>(() => client.GetAllForRepository("owner", "name", null)); Assert.Throws<ArgumentNullException>(() => client.GetAllForRepository(1, null)); Assert.Throws<ArgumentException>(() => client.GetAllForRepository("", "name")); Assert.Throws<ArgumentException>(() => client.GetAllForRepository("owner", "")); Assert.Throws<ArgumentException>(() => client.GetAllForRepository("", "name", ApiOptions.None)); Assert.Throws<ArgumentException>(() => client.GetAllForRepository("owner", "", ApiOptions.None)); }
public void RequestsCorrectUrlWithApiOptions() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableIssueCommentsClient(gitHubClient); var request = new IssueCommentRequest() { Direction = SortDirection.Descending, Since = new DateTimeOffset(2016, 11, 23, 11, 11, 11, 00, new TimeSpan()), Sort = PullRequestReviewCommentSort.Updated }; var options = new ApiOptions { StartPage = 1, PageSize = 1, PageCount = 1 }; client.GetAllForRepository("fake", "repo", request, options); gitHubClient.Connection.Received(1).Get<List<IssueComment>>( new Uri("repos/fake/repo/issues/comments", UriKind.Relative), Arg.Is<Dictionary<string, string>>(d => d.Count == 5 && d["direction"] == "desc" && d["since"] == "2016-11-23T11:11:11Z" && d["sort"] == "updated"), "application/vnd.github.squirrel-girl-preview"); }