public void Can_Paginate()
        {
            //Arrange
               Mock<IProductService> mock= new Mock<IProductService>();
               var products = new List<Product>();

               mock.Setup(m => m.GetAllProduct()).Returns((new Product[]
                                                          {
                                                              new Product(){ProductId=1,ProductName = "P1"} ,
                                                               new Product(){ProductId=2,ProductName = "P2"} ,
                                                                new Product(){ProductId=3,ProductName = "P3"} ,
                                                                 new Product(){ProductId=4,ProductName = "P4"} ,
                                                                  new Product(){ProductId=5,ProductName = "P5"} ,

                                                          }).ToList());

               ProductController controller=new ProductController(mock.Object);

               controller.PageSize = 3;

               //Act

               ProductListViewModel result = (ProductListViewModel)controller.Index(2).Model;

               //Assert
               Product[] prodArray = result.Products.ToArray();
               Assert.IsTrue(prodArray.Length==2);
               Assert.AreEqual(prodArray[0].ProductName,"P4");
               Assert.AreEqual(prodArray[1].ProductName,"P5");
        }
        public void Can_Send_Pagination_View_Model()
        {
            Mock<IProductService> mock = new Mock<IProductService>();

            mock.Setup(m => m.GetAllProduct()).Returns((new Product[]
                                                          {
                                                              new Product(){ProductId=1,ProductName = "P1"} ,
                                                               new Product(){ProductId=2,ProductName = "P2"} ,
                                                                new Product(){ProductId=3,ProductName = "P3"} ,
                                                                 new Product(){ProductId=4,ProductName = "P4"} ,
                                                                  new Product(){ProductId=5,ProductName = "P5"} ,

                                                          }).ToList());

            ProductController controller = new ProductController(mock.Object);

            controller.PageSize = 3;

            //Act
            ProductListViewModel result = (ProductListViewModel) controller.Index(2).Model;

            //Assert
            PagingInfo pagingInfo = result.PagingInfo;
            Assert.AreEqual(pagingInfo.CurrentPage,2);
            Assert.AreEqual(pagingInfo.ItemsPerPage,3);
            Assert.AreEqual(pagingInfo.TotalItems,5);
            Assert.AreEqual(pagingInfo.TotalPages,2);
        }