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 ObservableEventsClient(gitHubClient); await AssertEx.Throws<ArgumentNullException>(async () => await client.GetAllForRepository(null, "name")); await AssertEx.Throws<ArgumentException>(async () => await client.GetAllForRepository("", "name")); await AssertEx.Throws<ArgumentNullException>(async () => await client.GetAllForRepository("owner", null)); await AssertEx.Throws<ArgumentException>(async () => await client.GetAllForRepository("owner", "")); }
public void RequestsCorrectUrl() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableEventsClient(gitHubClient); client.GetAllForRepository("fake", "repo"); gitHubClient.Connection.Received(1).GetAsync<List<Activity>>(new Uri("repos/fake/repo/issues/events", UriKind.Relative), null, null); }
public void RequestsCorrectUrlWithRepositoryId() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableEventsClient(gitHubClient); client.GetAllForRepository(1); gitHubClient.Connection.Received(1).Get<List<Activity>>(new Uri("repositories/1/events", UriKind.Relative), Args.EmptyDictionary, null); }
public void RequestsCorrectUrlWithApiOptions() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableEventsClient(gitHubClient); var options = new ApiOptions { PageCount = 1, StartPage = 1, PageSize = 1 }; client.GetAllForRepository("fake", "repo", options); gitHubClient.Connection.Received(1).Get<List<Activity>>(new Uri("repos/fake/repo/events", UriKind.Relative), Arg.Is<IDictionary<string, string>>(d => d.Count == 2), null); }
public void EnsuresNonNullArguments() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableEventsClient(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)); }