예제 #1
0
        public void Can_filter_by_category()
        {
            var controller = new ProductController(new ProductRepository());

            var product = (ProductsListViewModel)controller.List("Golf").Model;

            product.Products.Count().ShouldBe(4);
            product.Products.First().Name.ShouldBe("Putter");

            product = (ProductsListViewModel)controller.List("Putter", 2).Model;

            product.Products.Count().ShouldBe(0);
        }
예제 #2
0
        public void Can_paginate()
        {
            var controller = new ProductController(new ProductRepository());

            var product = (ProductsListViewModel)controller.List(null).Model;

            product.Products.Count().ShouldBe(4);
            product.Products.First().Name.ShouldBe("Soccer Ball");

            product = (ProductsListViewModel)controller.List(null, 2).Model;

            product.Products.Count().ShouldBe(4);
            product.Products.First().Name.ShouldBe("Swim Cap");

            product = (ProductsListViewModel)controller.List(null, 3).Model;

            product.Products.Count().ShouldBe(4);
            product.Products.First().Name.ShouldBe("Pitching Wedge");
        }