Exemple #1
0
        public void CategoriesReturnsEveryCategory()
        {
            // Arrange - create a controller
            var controller = new ProductController(_mockRepository.Object);

            // Action
            var result = (PartialViewResult)controller.Categories();

            // Assert
            Assert.AreEqual(((IQueryable <Category>)result.ViewData.Model).Count(), 5);
            Assert.IsTrue(((IQueryable <Category>)result.ViewData.Model).Count(o => o.Name == "C4") == 2);
        }