2013-07-19 03:47:55 +00:00
|
|
|
|
using FluentAssertions;
|
2013-05-07 07:22:19 +00:00
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using NzbDrone.Core.Datastore;
|
|
|
|
|
using NzbDrone.Core.Tv;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Test.Datastore.PagingSpecExtenstionsTests
|
|
|
|
|
{
|
|
|
|
|
public class PagingOffsetFixture
|
|
|
|
|
{
|
|
|
|
|
[TestCase(1, 10, 0)]
|
|
|
|
|
[TestCase(2, 10, 10)]
|
|
|
|
|
[TestCase(3, 20, 40)]
|
|
|
|
|
[TestCase(1, 100, 0)]
|
|
|
|
|
public void should_calcuate_expected_offset(int page, int pageSize, int expected)
|
|
|
|
|
{
|
|
|
|
|
var pagingSpec = new PagingSpec<Episode>
|
|
|
|
|
{
|
|
|
|
|
Page = page,
|
|
|
|
|
PageSize = pageSize,
|
|
|
|
|
SortDirection = SortDirection.Ascending,
|
|
|
|
|
SortKey = "AirDate"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
pagingSpec.PagingOffset().Should().Be(expected);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|