示例#1
0
 private void InitCustomers()
 {
     if (_pagedCustomers == null)
     {
         var customers = bo.GetCustomers();
         _pagedCustomers = new PagedList <Customer>(customers, _pageSize);
     }
 }
示例#2
0
        public void TestNoofPagesInTheListOfCustomers()
        {
            BONorthWind bnw               = new BONorthWind();
            var         customers         = bnw.GetCustomers();
            int         pageSize          = 10;
            int         noOfPagesExpected = customers.Count / pageSize + 1;
            var         customerPaged     = new PagedList <Customer>(customers, pageSize);

            Assert.AreEqual(noOfPagesExpected, customerPaged.NoPages);
            List <Customer> customeratPageN = customerPaged.GetListFromPage(customerPaged.NoPages);

            Assert.AreEqual(customeratPageN.Count, (customers.Count - (customerPaged.NoPages - 1) * pageSize));
        }