title: When unit testing, how do I mock a return null from async method?
body: <p>Normally, I mock my repo like so:</p>
  
  <pre><code>var repository = new Mock&lt;ISRepository&gt;();
  repository.Setup(r =&gt; r.GetMemberAsync(email))
      .Returns(Task.FromResult(new Member
      {
          FirstName = firstName,
          LastName = lastName
      }));
  </code></pre>
  
  <p>But, in my code, I check to see if the member is not found, i.e. GetMemberAsync returns null.  How do I mock this?</p>
  
  <p>I tried:</p>
  
  <pre><code>var repository = new Mock&lt;ISRepository&gt;();
  repository.Setup(r =&gt; r.GetMemberAsync(email))
      .Returns(Task.FromResult&lt;object&gt;(null));
  </code></pre>
  
  <p>but I get a compile error.</p>