title: How can I test a method with a Task return type?
body: <p>I am trying to test a method whose signature is of the form  </p>
  
  <pre><code>public async Task&lt;List&lt;int&gt;&gt; MethodToBeTested()
  </code></pre>
  
  <p>I have written a unit test as follows </p>
  
  <pre><code>[TestMethod] 
  public async Task MethodToBeTestedSuccess()
  {
  Task&lt;List&lt;int&gt;&gt; results = await MethodToBeTested()
  ......
  }
  </code></pre>
  
  <p>If the method's return type had been a generic List of integers I would have performed the following steps to test the output </p>
  
  <pre><code>List&lt;int&gt; results = MethodToBeTested();
  int numberOfResults = results.Count;
  Assert.AreEqual(numberOfResults,2300);
  </code></pre>
  
  <p>My question therefore is: how can I test the async method, whose return type is wrapped in a task, and validate that 2300 results have been returned? </p>
  
  <p>If I try the strategy I attempted on the generic list of integers I get the error: cannot convert the method group Count to non-delegate type int. </p>
  
  <p>Thanks in advance for any help. </p>