Beispiel #1
0
        public void CannotEditNonexistentCategory()
        {
            // Arrange - create a controller
            var controller = new AdminController(this._mockRepository.Object);

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

            // Assert
            Assert.IsNull(result);
        }
Beispiel #2
0
        public void CanEditCategory()
        {
            // Arrange - create a controller
            var controller = new AdminController(this._mockRepository.Object);

            // Action
            var c1 = controller.EditCategory(1).ViewData.Model as Category;
            var c2 = controller.EditCategory(2).ViewData.Model as Category;
            var c3 = controller.EditCategory(3).ViewData.Model as Category;

            // Assert
            Assert.AreEqual(1, c1.CategoryId);
            Assert.AreEqual(2, c2.CategoryId);
            Assert.AreEqual(3, c3.CategoryId);
        }