mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-03 11:05:56 +00:00
Add ApiOption overloads to methods on IRepositoryHooksClient (#1272)
This commit is contained in:
committed by
Brendan Forster
parent
a44feaa7c3
commit
190ccf04c2
@@ -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)]
|
||||
|
||||
Reference in New Issue
Block a user