diff --git a/PoweredSoft.DynamicQuery.Test/CriteriaTests.cs b/PoweredSoft.DynamicQuery.Test/CriteriaTests.cs index a95d1da..711074f 100644 --- a/PoweredSoft.DynamicQuery.Test/CriteriaTests.cs +++ b/PoweredSoft.DynamicQuery.Test/CriteriaTests.cs @@ -24,5 +24,24 @@ namespace PoweredSoft.DynamicQuery.Test Assert.Equal(resultShouldMatch, result.Data); }); } + + [Fact] + public void TestPagging() + { + MockContextFactory.SeedAndTestContextFor("CriteriaTests_TestPagging", TestSeeders.SimpleSeedScenario, ctx => + { + var resultShouldMatch = ctx.OrderItems.OrderBy(t => t.Id).Skip(5).Take(5).ToList(); + + // query handler that is empty should be the same as running to list. + var criteria = new QueryCriteria(); + criteria.Sorts.Add(new Sort("Id")); + criteria.Page = 2; + criteria.PageSize = 5; + + var queryHandler = new QueryHandler(); + var result = queryHandler.Execute(ctx.OrderItems, criteria); + Assert.Equal(resultShouldMatch, result.Data); + }); + } } } diff --git a/README.md b/README.md index c615ff5..4e6dfa5 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ Criteria must implement the following interfaces Object | Interface | Implementation | Example | Description -----------------|--------------------------------------------------------------------------|-------------------------------------------------------------------------------|----------------------------------------------------------------------|-------------------------------------------- Query Criteria | [interface](../master/PoweredSoft.DynamicQuery.Core/IQueryCriteria.cs) | [default implementation](../master/PoweredSoft.DynamicQuery/QueryCriteria.cs) | [test](../master/PoweredSoft.DynamicQuery.Test/CriteriaTests.cs#L13) | Wraps the query parameters +Pagging | [interface](../master/PoweredSoft.DynamicQuery.Core/IQueryCriteria.cs) | [default implementation](../master/PoweredSoft.DynamicQuery/QueryCriteria.cs) | [test](../master/PoweredSoft.DynamicQuery.Test/CriteriaTests.cs#L29) | Pagging support Filter | [interface](../master/PoweredSoft.DynamicQuery.Core/IFilter.cs) | [default implementation](../master/PoweredSoft.DynamicQuery/Filter.cs) | [test](../master/PoweredSoft.DynamicQuery.Test/FilterTests.cs#L22) | Represent a filter to be executed Simple Filter | [interface](../master/PoweredSoft.DynamicQuery.Core/ISimpleFilter.cs) | [default implementation](../master/PoweredSoft.DynamicQuery/Filter.cs) | [test](../master/PoweredSoft.DynamicQuery.Test/FilterTests.cs#L40) | Represent a simple filter to be executed Composite Filter | [interface](../master/PoweredSoft.DynamicQuery.Core/ICompositeFilter.cs) | [default implementation](../master/PoweredSoft.DynamicQuery/Filter.cs) | [test](../master/PoweredSoft.DynamicQuery.Test/FilterTests.cs#L68) | Represent a composite filter to be executed