Add repositoryId overloads to methods on I(Observable)StarredClient (#1389)

* modified XML docs

* updated xml docs

* added new overloads

* added new unit tests

* added new integration tests

* revert xml back a little

* fixed failed tests

* cleared <returns> tags

* removed <returns> tags

* remove <returns> tags
This commit is contained in:
Alexander Efremov
2016-07-03 05:01:31 -07:00
committed by Ryan Gribble
parent 9cf39defc1
commit e701ae763c
7 changed files with 458 additions and 250 deletions
@@ -35,6 +35,20 @@ namespace Octokit.Tests.Reactive
connection.Received().Get<List<User>>(endpoint, Args.EmptyDictionary, null);
}
[Fact]
public void RequestsCorrectUrlWithRepositoryId()
{
var endpoint = new Uri("repositories/1/stargazers", UriKind.Relative);
var connection = Substitute.For<IConnection>();
var gitHubClient = Substitute.For<IGitHubClient>();
gitHubClient.Connection.Returns(connection);
var client = new ObservableStarredClient(gitHubClient);
client.GetAllStargazers(1);
connection.Received().Get<List<User>>(endpoint, Args.EmptyDictionary, null);
}
[Fact]
public void RequestsCorrectUrlWithApiOptions()
{
@@ -56,6 +70,27 @@ namespace Octokit.Tests.Reactive
connection.Received().Get<List<User>>(endpoint, Arg.Is<IDictionary<string, string>>(d => d.Count == 2), null);
}
[Fact]
public void RequestsCorrectUrlWithApiOptionsWithRepositoryId()
{
var endpoint = new Uri("repositories/1/stargazers", UriKind.Relative);
var connection = Substitute.For<IConnection>();
var gitHubClient = Substitute.For<IGitHubClient>();
gitHubClient.Connection.Returns(connection);
var client = new ObservableStarredClient(gitHubClient);
var options = new ApiOptions
{
PageCount = 1,
StartPage = 1,
PageSize = 1
};
client.GetAllStargazers(1, options);
connection.Received().Get<List<User>>(endpoint, Arg.Is<IDictionary<string, string>>(d => d.Count == 2), null);
}
[Fact]
public void RequestsCorrectUrlWithTimestamps()
{
@@ -70,6 +105,20 @@ namespace Octokit.Tests.Reactive
connection.Received().Get<List<UserStar>>(endpoint, Args.EmptyDictionary, "application/vnd.github.v3.star+json");
}
[Fact]
public void RequestsCorrectUrlWithTimestampsWithRepositoryId()
{
var endpoint = new Uri("repositories/1/stargazers", UriKind.Relative);
var connection = Substitute.For<IConnection>();
var gitHubClient = Substitute.For<IGitHubClient>();
gitHubClient.Connection.Returns(connection);
var client = new ObservableStarredClient(gitHubClient);
client.GetAllStargazersWithTimestamps(1);
connection.Received().Get<List<UserStar>>(endpoint, Args.EmptyDictionary, "application/vnd.github.v3.star+json");
}
[Fact]
public void RequestsCorrectUrlWithTimestampsWithApiOptions()
{
@@ -91,6 +140,27 @@ namespace Octokit.Tests.Reactive
connection.Received().Get<List<UserStar>>(endpoint, Arg.Is<IDictionary<string, string>>(d => d.Count == 2), "application/vnd.github.v3.star+json");
}
[Fact]
public void RequestsCorrectUrlWithTimestampsWithApiOptionsWithRepositoryId()
{
var endpoint = new Uri("repositories/1/stargazers", UriKind.Relative);
var connection = Substitute.For<IConnection>();
var gitHubClient = Substitute.For<IGitHubClient>();
gitHubClient.Connection.Returns(connection);
var client = new ObservableStarredClient(gitHubClient);
var options = new ApiOptions
{
PageCount = 1,
StartPage = 1,
PageSize = 1
};
client.GetAllStargazersWithTimestamps(1, options);
connection.Received().Get<List<UserStar>>(endpoint, Arg.Is<IDictionary<string, string>>(d => d.Count == 2), "application/vnd.github.v3.star+json");
}
[Fact]
public void EnsuresNonNullArguments()
{
@@ -107,6 +177,9 @@ namespace Octokit.Tests.Reactive
Assert.Throws<ArgumentNullException>(() => client.GetAllStargazersWithTimestamps("fight", null, ApiOptions.None));
Assert.Throws<ArgumentNullException>(() => client.GetAllStargazersWithTimestamps("fight", "club", null));
Assert.Throws<ArgumentNullException>(() => client.GetAllStargazers(1, null));
Assert.Throws<ArgumentNullException>(() => client.GetAllStargazersWithTimestamps(1, null));
Assert.Throws<ArgumentException>(() => client.GetAllStargazers("", "club"));
Assert.Throws<ArgumentException>(() => client.GetAllStargazers("fight", ""));
Assert.Throws<ArgumentException>(() => client.GetAllStargazers("", "club", ApiOptions.None));