public void Produces_Home_Plus_NaLink_Object_For_Each_Distinct_Category()
        {
            // Подготовка
            IQueryable<Product> products = new[] {
                new Product { Name="A", Category="Animal" },
                new Product { Name="B", Category="Vegetable" },
                new Product { Name="C", Category="Mineral" },
                new Product { Name="D", Category="Vegetable" },
                new Product { Name="E",Category="Animal" }
            }.AsQueryable();
            var mockProductRepository = new Moq.Mock<IProductsRepository>();
            mockProductRepository.Setup(x => x.Products).Returns(products);
            var controller = new NavController(mockProductRepository.Object);

            // Действие
            ViewResult result = controller.Menu(null);

            var links = ((IEnumerable<NavLink>)result.ViewData.Model).ToList();
            Assert.AreEqual(4, links.Count);
            Assert.AreEqual("All", links[0].Text);
            Assert.AreEqual("Animal", links[1].Text);
            Assert.AreEqual("Mineral", links[2].Text);
            Assert.AreEqual("Vegetable", links[3].Text);
            foreach(var link in links)
            {
                Assert.AreEqual("Products", link.RouteValues["controller"]);
                Assert.AreEqual("List", link.RouteValues["action"]);
                Assert.AreEqual(1, link.RouteValues["page"]);
                if (links.IndexOf(link) == 0)
                    Assert.IsNull(link.RouteValues["category"]);
                else
                    Assert.AreEqual(link.Text, link.RouteValues["category"]);
            }
        }
        public void Highlights_CurrentCategory()
        {
            // Подготовка
            IQueryable<Product> products = new[] {
                new Product { Name="A",Category ="Animal" },
                new Product { Name="B",Category="Vegetable"}
            }.AsQueryable();
            var mockProductsRepository = new Moq.Mock<IProductsRepository>();
            mockProductsRepository.Setup(x => x.Products).Returns(products);
            var controller = new NavController(mockProductsRepository.Object);

            // Действие
            var result = controller.Menu("Vegetable");

            // Утверждение
            var highlightedLinks = ((IEnumerable<NavLink>)result.ViewData.Model)
                                   .Where(x => x.IsSelected).ToList();
            Assert.AreEqual(1, highlightedLinks.Count);
            Assert.AreEqual("Vegetable", highlightedLinks[0].Text);
        }