Running the Project

Create a new View from FindByGenre ViewResult. There is a quick way by using view template from .NET framework.

After that, we could create the complete list of products when we called the default constructor of HomeController.

public HomeController()
{
    repository = new ExpectedProductRepository();
}

The ExpectedProductRepository must implement the Repository Interface.

internal class ExpectedProductRepository : Repository
{
    public List<Product> GetAll()
    {
        return new List<Product>()
        {
            new Product { Genre = "Fiction", Id = 1, Name = "Hunger Games", Price = 200000 },
            new Product { Genre = "Fiction", Id = 2, Name = "Hunger Games 2", Price = 300000 },
            new Product { Genre = "Mistery", Id = 3, Name = "The Pilgrimage", Price = 400000 },
            new Product { Genre = "Non-Fiction", Id = 4, Name = "Multatuli", Price = 500000 },
            new Product { Genre = "Health", Id = 5, Name = "Sehat Setiap Pagi", Price = 4000 },
            new Product { Genre = "Music", Id = 6, Name = "Learning Guitar in 10 minutes", Price = 240000 },
            new Product { Genre = "Religion", Id = 7, Name = "Who Am I?", Price = 800000 },
            new Product { Genre = "Self-Imprvement", Id = 3, Name = "Finding Success", Price = 300000 },
            new Product { Genre = "Kids", Id = 3, Name = "Berhitung Yuk", Price = 20000 }
        };
    }
}

results matching ""

    No results matching ""