Ejemplo n.º 1
0
        public void CannotEditNonexistentParentCategory()
        {
            // Arrange - create a controller
            var controller = new AdminController(this._mockRepository.Object);

            // Action
            var result = (Category)controller.EditParentCategory(6).ViewData.Model;

            // Assert
            Assert.IsNull(result);
        }
Ejemplo n.º 2
0
        public void CanEditProductCategory()
        {
            // Arrange - create a controller
            var controller = new AdminController(this._mockRepository.Object);

            // Action
            var pc1 = controller.EditParentCategory(1).ViewData.Model as ParentCategory;
            var pc2 = controller.EditParentCategory(2).ViewData.Model as ParentCategory;
            var pc3 = controller.EditParentCategory(3).ViewData.Model as ParentCategory;

            // Assert
            Assert.AreEqual(1, pc1.ParentCategoryId);
            Assert.AreEqual(2, pc2.ParentCategoryId);
            Assert.AreEqual(3, pc3.ParentCategoryId);
        }