View Results

When the view name is the same as the action name, explicitly or via an empty string, do this:

_controller.WithCallTo(c => c.Index()).ShouldRenderDefaultView();

// Or, if you want to check a partial is returned
_controller.WithCallTo(c => c.Index()).ShouldRenderDefaultPartialView();

Otherwise:

_controller.WithCallTo(c => c.Index()).ShouldRenderView("ViewName");

// Or, if you want to check a partial is returned
_controller.WithCallTo(c => c.Index()).ShouldRenderPartialView("ViewName");

Unfortunately, we couldn't think of a way to get rid of the magic strings here so where possible use the default ones above.

See Child Actions for view model testing.