public async Task Page()
{
// In this test we're checking that the page count is correct when there are
// not-exactly pagesize*N records (ie: a partial page at the end)
// Create some records
const int count = 13;
long id = await InsertRecordsAsync(count);
// Fetch em
var r = await db.PageAsync<poco>(2, 5, "SELECT * from petapoco ORDER BY id");
// Check em
int i = 0;
foreach (var p in r.Items)
{
Assert.AreEqual(p.id, id + i + 5);
i++;
}
// Check other stats
Assert.AreEqual(r.Items.Count, 5);
Assert.AreEqual(r.CurrentPage, 2);
Assert.AreEqual(r.ItemsPerPage, 5);
Assert.AreEqual(r.TotalItems, 13);
Assert.AreEqual(r.TotalPages, 3);
}