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