title: Moq ReturnsAsync() with parameters
body: <p>I'm trying to mock a repository's method like that</p>
  
  <pre><code>public async Task&lt;WhitelistItem&gt; GetByTypeValue(WhitelistType type, string value)
  </code></pre>
  
  <p>using Moq ReturnsAsync, like this:</p>
  
  <pre><code>static List&lt;WhitelistItem&gt; whitelist = new List&lt;WhitelistItem&gt;();
  
  var whitelistRepositoryMock = new Mock&lt;IWhitelistRepository&gt;();
  
  whitelistRepositoryMock.Setup(w =&gt; w.GetByTypeValue(It.IsAny&lt;WhitelistType&gt;(), It.IsAny&lt;string&gt;()))
                                      .ReturnsAsync((WhitelistType type, string value) =&gt;
                                      {
                                          return (from  item in whitelist
                                                  where item.Type == type &amp;&amp; item.Value == value
                                                  select item).FirstOrDefault();
                                      });
  </code></pre>
  
  <p>but i'm getting this error in the line "... ReturnsAsync((WhitelistType type...): </p>
  
  <blockquote>
    <p>Cannot convert lambda expression to type 'Model.WhitelistItem' because
    it is not a delegate type</p>
  </blockquote>
  
  <p>WhitelistType is an Enum like that:</p>
  
  <pre><code>public enum WhitelistType
      {
          UserName,
          PostalCode
      }
  </code></pre>
  
  <p>I searched by hours and didn't found any answer to my problem.</p>
  
  <p>Any clues?</p>