public void IndexWillReturnViewModelWithCorrectProducts()
        {
            // Fixture setup
            var fixture          = new ControllerFixture();
            var featuredProducts =
                fixture.CreateMany <Product>().ToList();

            fixture.Freeze <Mock <ProductRepository> >()
            .Setup(r => r.GetFeaturedProducts())
            .Returns(featuredProducts);

            var expectedProducts = (from p in featuredProducts
                                    select new Likeness <Product, ProductViewModel>(p)
                                    .Without(d => d.SummaryText)
                                    .Without(d => d.UnitPrice)
                                    ).ToList();

            var sut =
                fixture.CreateAnonymous <HomeController>();
            // Exercise system
            var result = ((FeaturedProductsViewModel)sut
                          .Index().ViewData.Model).Products.ToList();

            // Verify outcome
            Assert.True(expectedProducts.Cast <object>().SequenceEqual(result.Cast <object>()));
            // Teardown
        }
        public void IndexWillReturnViewModelWithCorrectProducts()
        {
            // Fixture setup
            var fixture = new ControllerFixture();
            var featuredProducts =
                fixture.CreateMany<Product>().ToList();
            fixture.Freeze<Mock<ProductRepository>>()
                .Setup(r => r.GetFeaturedProducts())
                .Returns(featuredProducts);

            var expectedProducts = (from p in featuredProducts
                                    select new Likeness<Product, ProductViewModel>(p)
                                        .Without(d => d.SummaryText)
                                        .Without(d => d.UnitPrice)
                                    ).ToList();

            var sut =
                fixture.CreateAnonymous<HomeController>();
            // Exercise system
            var result = ((FeaturedProductsViewModel)sut
                .Index().ViewData.Model).Products.ToList();
            // Verify outcome
            Assert.True(expectedProducts.Cast<object>().SequenceEqual(result.Cast<object>()));
            // Teardown
        }