
Untitled
By: a guest on
May 1st, 2012 | syntax:
None | size: 0.44 KB | hits: 17 | expires: Never
const int pageSize = 10;
var allProducts = database.Products.All(); //15 products
//products 1-10
var firstPage = allProducts.ToPagedList(0, pageSize);
Assert.Equal(10, firstPage.Count);
Assert.False(firstPage.HasPreviousPage);
Assert.True(firstPage.HasNextPage);
//products 11-15
var secondPage = allProducts.ToPagedList(1, pageSize);
Assert.Equal(5, secondPage.Count);
Assert.False(secondPage.IsFirstPage);
Assert.True(secondPage.IsLastPage);