public void non_admin_product_list_products()
        {
            //Arrange
            var controller = new ProductController(new ProductBLL(new ProductDALStub()));

            //Act
            var result = (RedirectToRouteResult)controller.ListProducts(null,null,null,null,null);

            //Assert
            Assert.AreEqual("LogIn", result.RouteValues["Action"]);
            Assert.AreEqual("Main", result.RouteValues["Controller"]);
        }
        public void product_list_products_name_desc()
        {
            // Arrange
            TestControllerBuilder builder = new TestControllerBuilder();

            var controller = new ProductController(new ProductBLL(new ProductDALStub()));
            builder.InitializeController(controller);
            builder.HttpContext.Session["loggedInUser"] = new Customer() { id=1, admin = true };

            // Act
            var action = (ViewResult)controller.ListProducts(2, 2, "name_desc", null, null);
            var result = (IPagedList<ProductInfo>)action.Model;

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(2, result.PageNumber);
            Assert.IsTrue(string.Compare(result[0].name, result[1].name) > 0);    
        }