title: Setup method to invoke function
body: <p>I have a method in my class which receives a function (<code>Func</code>) as a parameter:</p>
  
  <pre><code>T Execute&lt;T&gt;(Func&lt;T&gt; func)
  {
      ...
      return func();
  }
  </code></pre>
  
  <p>I wish to mock this class, and have Moq calling the function I send to <code>Execute</code> as a parameter.</p>
  
  <p>How I call <code>Execute</code>:</p>
  
  <pre><code>string result = await executor.Execute(async () =&gt; await GetResponse(query));
  </code></pre>
  
  <p>So I would like Moq to call GetResponse and return its value. How can I do so?</p>