mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-05 23:06:10 +00:00
47 lines
1.5 KiB
C#
47 lines
1.5 KiB
C#
using System;
|
|
using Octokit.Models.Request.Enterprise;
|
|
using Xunit;
|
|
|
|
namespace Octokit.Tests.Http
|
|
{
|
|
public class PaginationTests
|
|
{
|
|
public class TheShouldContinueMethod
|
|
{
|
|
[Fact]
|
|
public void HandlesMissingUri()
|
|
{
|
|
var result = Pagination.ShouldContinue(null, null);
|
|
Assert.False(result);
|
|
}
|
|
|
|
[Fact]
|
|
public void HandlesIsDone()
|
|
{
|
|
var uri = new Uri("http://example.com");
|
|
var options = new ApiOptionsExtended { IsDone = true };
|
|
var result = Pagination.ShouldContinue(uri, options);
|
|
Assert.False(result);
|
|
}
|
|
|
|
[Fact]
|
|
public void HandlesPageCountPageFirstParam()
|
|
{
|
|
var uri = new Uri("http://example.com?page=2");
|
|
var options = new ApiOptions { StartPage = 1, PageCount = 1 };
|
|
var result = Pagination.ShouldContinue(uri, options);
|
|
Assert.False(result);
|
|
}
|
|
|
|
[Fact]
|
|
public void HandlesPageCountPageNotFirstParam()
|
|
{
|
|
var uri = new Uri("http://example.com?page_size=100&page=2");
|
|
var options = new ApiOptions { StartPage = 1, PageCount = 1 };
|
|
var result = Pagination.ShouldContinue(uri, options);
|
|
Assert.False(result);
|
|
}
|
|
}
|
|
}
|
|
}
|