public void CreateThenList()
        {
            // Arrange
            var controller = new HomeController(_fakeRepository);
            var productToCreate = Product.CreateProduct(-1, "Test", "Test", 3.44m);

            // Act
            controller.Create(productToCreate);
            var results = (ViewResult)controller.Index();

            // Assert
            var products = (ICollection)results.ViewData.Model;
            CollectionAssert.Contains(products, productToCreate);
        }
        public void NameIsRequired()
        {
            // Arrange
            var controller = new HomeController(_mockRepository.Object);
            var productToCreate = new Product();
            productToCreate.Name = String.Empty;

            // Act
            var result = (ViewResult)controller.Create(productToCreate);

            // Assert
            var modelStateError = result.ViewData.ModelState["Name"].Errors[0].ErrorMessage;
            Assert.AreEqual("Product name is required.", modelStateError);
        }