title: How to get the Values from a Task<IActionResult> returned through an API for Unit Testing
body: <p>I have created an API using ASP.NET MVC Core v2.1. One of my <code>HttpGet</code> methods is set up as follows:</p>
  
  <pre><code>public async Task&lt;IActionResult&gt; GetConfiguration([FromRoute] int? id)
  {
      try
      {
          if (!ModelState.IsValid)
          {
              return BadRequest(ModelState);
          }
  
          ..... // Some code here
  
          return Ok(configuration);
      }
      catch (Exception ex)
      {
          ... // Some code here
      }
  }
  </code></pre>
  
  <p>When unit testing this I can check that Ok was the response, but I really need to see the values of the configuration. I don't seem to be able to get this to work with the following:</p>
  
  <pre><code>[TestMethod] 
  public void ConfigurationSearchGetTest()
  {
      var context = GetContextWithData();
      var controller = new ConfigurationSearchController(context);
      var items = context.Configurations.Count();
      var actionResult = controller.GetConfiguration(12);
  
      Assert.IsTrue(true);
      context.Dispose();
  }
  </code></pre>
  
  <p>At runtime, I can check that <code>actionResult</code> has certain values that I am unable to code for. Is there something I am doing wrong? Or am I just thinking about this wrong? I would like to be able to do:</p>
  
  <pre><code>Assert.AreEqual(12, actionResult.Values.ConfigurationId);
  </code></pre>