Add ApiOptions overloads to I(Observable)RepositoriesClient (#1337)

This commit is contained in:
Brendan Forster
2016-06-14 10:15:05 +10:00
committed by GitHub
parent 02c677d832
commit 7e8552dae8
7 changed files with 899 additions and 65 deletions
@@ -83,21 +83,22 @@ namespace Octokit.Tests.Reactive
{
new Repository(7)
});
var gitHubClient = Substitute.For<IGitHubClient>();
gitHubClient.Connection.GetResponse<List<Repository>>(firstPageUrl)
gitHubClient.Connection.Get<List<Repository>>(firstPageUrl, Arg.Any<IDictionary<string,string>>(), null)
.Returns(Task.Factory.StartNew<IApiResponse<List<Repository>>>(() => firstPageResponse));
gitHubClient.Connection.GetResponse<List<Repository>>(secondPageUrl)
gitHubClient.Connection.Get<List<Repository>>(secondPageUrl, Arg.Any<IDictionary<string, string>>(), null)
.Returns(Task.Factory.StartNew<IApiResponse<List<Repository>>>(() => secondPageResponse));
gitHubClient.Connection.GetResponse<List<Repository>>(thirdPageUrl)
gitHubClient.Connection.Get<List<Repository>>(thirdPageUrl, Arg.Any<IDictionary<string, string>>(), null)
.Returns(Task.Factory.StartNew<IApiResponse<List<Repository>>>(() => lastPageResponse));
var repositoriesClient = new ObservableRepositoriesClient(gitHubClient);
var results = await repositoriesClient.GetAllForCurrent().ToArray();
Assert.Equal(7, results.Length);
gitHubClient.Connection.Received(1).Get<List<Repository>>(firstPageUrl, null, null);
gitHubClient.Connection.Received(1).Get<List<Repository>>(secondPageUrl, null, null);
gitHubClient.Connection.Received(1).Get<List<Repository>>(thirdPageUrl, null, null);
gitHubClient.Connection.Received(1).Get<List<Repository>>(firstPageUrl, Arg.Any<IDictionary<string, string>>(), null);
gitHubClient.Connection.Received(1).Get<List<Repository>>(secondPageUrl, Arg.Any<IDictionary<string, string>>(), null);
gitHubClient.Connection.Received(1).Get<List<Repository>>(thirdPageUrl, Arg.Any<IDictionary<string, string>>(), null);
}
[Fact(Skip = "See https://github.com/octokit/octokit.net/issues/1011 for issue to investigate this further")]
@@ -245,7 +246,7 @@ namespace Octokit.Tests.Reactive
client.GetAllBranches("owner", "repo");
github.Connection.Received(1).GetResponse<List<Branch>>(expected);
github.Connection.Received(1).Get<List<Branch>>(expected, Args.EmptyDictionary, null);
}
}
@@ -382,7 +383,9 @@ namespace Octokit.Tests.Reactive
client.GetAllTeams("owner", "repo");
github.Connection.Received(1).GetResponse<List<Team>>(expected);
github.Connection.Received(1).Get<List<Team>>(expected,
Arg.Any<IDictionary<string, string>>(),
Arg.Any<string>());
}
}
@@ -408,7 +411,7 @@ namespace Octokit.Tests.Reactive
client.GetAllTags("owner", "repo");
github.Connection.Received(1).GetResponse<List<RepositoryTag>>(expected);
github.Connection.Received(1).Get<List<RepositoryTag>>(expected, Arg.Any<IDictionary<string,string>>(), null);
}
}