pagging tests.

This commit is contained in:
David Lebee 2018-10-22 22:42:57 -05:00
parent 7a39d70a3e
commit 96da976199
2 changed files with 20 additions and 0 deletions

View File

@ -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);
});
}
}
}

View File

@ -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