Add ApiOption overloads to methods on IRepositoryHooksClient (#1272)

This commit is contained in:
Alexander Efremov
2016-04-19 14:08:02 +07:00
committed by Brendan Forster
parent a44feaa7c3
commit 190ccf04c2
11 changed files with 370 additions and 11 deletions
@@ -25,11 +25,70 @@ namespace Octokit.Tests.Integration.Clients
var hooks = await github.Repository.Hooks.GetAll(_fixture.RepositoryOwner, _fixture.RepositoryName);
Assert.Single(hooks);
var actualHook = hooks[0];
Assert.Equal(_fixture.ExpectedHooks.Count, hooks.Count);
var actualHook = hooks[0];
AssertHook(_fixture.ExpectedHook, actualHook);
}
[IntegrationTest]
public async Task ReturnsCorrectCountOfHooksWithoutStart()
{
var github = Helper.GetAuthenticatedClient();
var options = new ApiOptions
{
PageSize = 5,
PageCount = 1
};
var hooks = await github.Repository.Hooks.GetAll(_fixture.RepositoryOwner, _fixture.RepositoryName, options);
Assert.Equal(_fixture.ExpectedHooks.Count, hooks.Count);
}
[IntegrationTest]
public async Task ReturnsCorrectCountOfHooksWithStart()
{
var github = Helper.GetAuthenticatedClient();
var options = new ApiOptions
{
PageSize = 2,
PageCount = 1,
StartPage = 3
};
var hooks = await github.Repository.Hooks.GetAll(_fixture.RepositoryOwner, _fixture.RepositoryName, options);
Assert.Equal(1, hooks.Count);
}
[IntegrationTest]
public async Task ReturnsDistinctResultsBasedOnStartPage()
{
var github = Helper.GetAuthenticatedClient();
var startOptions = new ApiOptions
{
PageSize = 2,
PageCount = 1
};
var firstPage = await github.Repository.Hooks.GetAll(_fixture.RepositoryOwner, _fixture.RepositoryName, startOptions);
var skipStartOptions = new ApiOptions
{
PageSize = 2,
PageCount = 1,
StartPage = 2
};
var secondPage = await github.Repository.Hooks.GetAll(_fixture.RepositoryOwner, _fixture.RepositoryName, skipStartOptions);
Assert.NotEqual(firstPage[0].Id, secondPage[0].Id);
Assert.NotEqual(firstPage[1].Id, secondPage[1].Id);
}
}
[Collection(RepositoriesHooksCollection.Name)]