예제 #1
0
 public CategoryControllerTests()
 {
     _categoryAdminService = A.Fake <ICategoryAdminService>();
     //use the default of the container existing
     A.CallTo(() => _categoryAdminService.ProductContainerExists()).Returns(true);
     _categoryController = new CategoryController(_categoryAdminService);
 }
예제 #2
0
 public CategoryControllerTests()
 {
     _categoryAdminService = A.Fake<ICategoryAdminService>();
     //use the default of the container existing
     A.CallTo(() => _categoryAdminService.ProductContainerExists()).Returns(true);
     _categoryController = new CategoryController(_categoryAdminService);
 }
예제 #3
0
        public void CategoryController_Index_ModelIsNullIfTheCategoryContainerDoesNotExist()
        {
            A.CallTo(() => _categoryAdminService.ProductContainerExists()).Returns(false);

            ViewResult index = _categoryController.Index("test", 1);

            index.Model.Should().BeNull();
        }
예제 #4
0
        public ViewResult Index(string q = null, int p = 1)
        {
            if (!_categoryAdminService.ProductContainerExists())
            {
                return(View());
            }
            IPagedList <Category> categoryPagedList = _categoryAdminService.Search(q, p);

            return(View(categoryPagedList));
        }