Making It Green

The test failed because we just return the view normally instead of filtering the repository based on its desired genre.

The idea is Index alike. Get all the products from repository, then filter based on the Genre.

public ViewResult FindByGenre(string genre)
    var products = repository.GetAll();
    var filteredProducts = products.Where(product => product.Genre == genre);
    return View(filteredProducts);

Build and Run the test again. Yeay, it is green.

results matching ""

    No results matching ""