lundi 5 octobre 2015

Unit test view in MVC - Confirm partial view is executed

I'm trying to assert that a particular partial view is rendered in a scenario like below.

@if (Model.IsLoggedIn)
{
   @Html.Partial("_LoggedIn")
}
else
{
   @Html.Partial("_NotLoggedIn")
}


var hc = new HomeController();

var actionResult = hc.Index(true);

Is there any way I can assert that a particular view name was rendered?

Thanks, David

Aucun commentaire:

Enregistrer un commentaire