title: Handle IActionResult in MVC6
body: <p>I build my first mvc6 api with :</p>
  
  <p><a href="https://docs.asp.net/en/latest/tutorials/first-web-api.html" rel="nofollow">https://docs.asp.net/en/latest/tutorials/first-web-api.html</a></p>
  
  <p>I wanted to write test for it now but how can I cast a IActionResult which returns a JSON string to an Model(e.g User) </p>
  
  <p>I get a error which says:</p>
  
  <p>Cannot Convert IAction result to User ...</p>
  
  <pre><code>[HttpGet("{}")]
  public IActionResult getUser()
  {
    Benutzer benutzerData = _context.benutzer.FirstOrDefault&lt;User&gt;();
  
    return new ObjectResult(benutzerData);
  }
  </code></pre>
  
  <p>and in my Test class :</p>
  
  <pre><code>  Benutzer user = _controller.getUser();
  </code></pre>