I have a view, and it has a partial view of rendering inside:
<div class="partialViewDiv">
@Html.RenderPartial("partial", Model.SomeModelProperty);
</div>
And the controller that returns this view
public ActionResult Action()
{
...
var model = new SomeModel(){SomeModelProperty = "SomeValue"}
return View("view", model);
}
How to check the visualization of a view, I know:
[TestMethod]
public void TestView()
{
...
var result = controller.Action();
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?
source
share