Esempio n. 1
0
        public void CategoryListReturnsAppropriateCategories()
        {
            // Arrange - create a controller
            var controller = new ProductController(_mockRepository.Object);

            // Action
            var result = (PartialViewResult)controller.CategoryList(2);

            // Assert
            Assert.AreEqual(((IEnumerable <Category>)result.ViewData.Model).Count(), 3);
            Assert.IsTrue(((IEnumerable <Category>)result.ViewData.Model).Count(o => o.Name == "C4") == 1);
        }