public void CanCreateCategory() {
            CategoriesController controller =
                new CategoriesController(CreateMockCategoryRepository());

            ViewResult result =
                controller.Create("Hawaiian").AssertViewRendered().ForView("");

            result.ViewData.ShouldNotBeNull();
            (result.ViewData.Model as Category).ShouldNotBeNull();
            (result.ViewData.Model as Category).Id.ShouldBeGreaterThan(0);
        }
        public void CanListCategories() {
            CategoriesController controller = 
                new CategoriesController(CreateMockCategoryRepository());

            ViewResult result = 
                controller.Index().AssertViewRendered().ForView("");

            result.ViewData.ShouldNotBeNull();
            (result.ViewData.Model as List<Category>).ShouldNotBeNull();
            (result.ViewData.Model as List<Category>).Count.ShouldEqual(3);
        }
        public void CanDetailCategory() {
            CategoriesController controller = 
                new CategoriesController(CreateMockCategoryRepository());

            ViewResult result = 
                controller.Show(1).AssertViewRendered().ForView("");

            // The builder object acts as a wrapper around the controller, 
            // so be sure to interrogate it instead of the controller
            result.ViewData.ShouldNotBeNull();
            (result.ViewData.Model as Category).ShouldNotBeNull();
            (result.ViewData.Model as Category).Id.ShouldEqual(1);
        }