I have a view and it has partial view rendering inside:
<div class="partialViewDiv">
@Html.RenderPartial("partial", Model.SomeModelProperty);
</div>
And a controller, which returns this view
public ActionResult Action()
{
...
var model = new SomeModel(){SomeModelProperty = "SomeValue"}
return View("view", model);
}
How to test view was rendered i know:
[TestMethod]
public void TestView()
{
...
var result = controller.Action();
// Assert
result.AssertViewRendered().ForView("view").WithViewData<SomeModel>();
}
but when I call
result.AssertPartialViewRendered().ForView("partial").WithViewData<SomeModelPropertyType>();
I get this error message
Expected result to be of type PartialViewResult. It is actually of type ViewResult.
What am I doing wrong?