Act Method

In previous test, we call Index ViewResult from controller. Now, we want to call another method that has desired genre that already being filtered.

We create a new ViewResult called FindByGenre that takes a string input parameter.

// Act
HomeController controller = new HomeController(productRepository);
ViewResult viewResult = controller.FindByGenre("Fiction");
var model = viewResult.Model as IEnumerable<Product>;

Hence, we need to create a new ViewResult in our controller.

public ViewResult FindByGenre(string genre)
{
    return View();
}

Just leave it blank because we need the test to be failed.

results matching ""

    No results matching ""