title: how to moq a func parameter when unit testing c#
body: <p>I'm trying to write some tests but I'm not sure how to handle the arguments for setting up my moq mock.  Can anyone suggest how I can complete this line of code correctly?
  Many thanks,</p>
  
  <p><strong>My moq code line</strong></p>
  
  <p><img src="https://i.stack.imgur.com/CMsRL.png" alt="enter image description here"></p>
  
  <p>The parameter is of type shown below for the Returns(...) which I'm not sure how to handle.</p>
  
  <p><strong>Parameter intellisense</strong></p>
  
  <p><img src="https://i.stack.imgur.com/5A5FF.png" alt="enter image description here"></p>
  
  <p>The method is shown below that I'm trying to moq out.</p>
  
  <p><strong>The method definition</strong></p>
  
  <pre><code>public static async Task&lt;CommandResult&gt; SendSupportAsync(this IBus bus, Command command, bool withLogging = true)
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I've tried the suggestion, I've added the mocked object and set up the return but the compiler gives the following error:</p>
  
  <pre><code>An expression tree may not contain a call or invocation that uses optional arguments
  </code></pre>