Ejemplo n.º 1
0
        public void CategoryController_DeleteCategory_ReturnsNonNullRedirectToAction()
        {
            //Arrange
            var mockCategoryRepository = new MockCategoryRepository();
            int id         = 1;
            var controller = new CategoryController(mockCategoryRepository);
            //Act
            var result = controller.DeleteCategory(id) as RedirectToRouteResult;

            //Assert
            Assert.IsNotNull(result);
        }
Ejemplo n.º 2
0
        public void CategoryController_AddCategory_ReturnsNonNullViewResult()
        {
            //Arrange
            var mockCategoryRepository = new MockCategoryRepository();

            var controller = new CategoryController(mockCategoryRepository);
            //Act
            var result = controller.AddCategory() as ViewResult;

            //Assert
            Assert.IsNotNull(result);
        }
Ejemplo n.º 3
0
        public void CategoryController_AddCategory_ChecksForInvalidModel()
        {
            //Arrange
            var mockCategoryRepository = new MockCategoryRepository();

            var controller = new CategoryController(mockCategoryRepository);
            var model      = new Category();
            //Act
            var result = controller.AddCategory(model) as ViewResult;
            //Assert


            //result.ViewName = "ErrorView";
        }