title: Error in moq "An expression tree may not contain a call or invocation that uses optional arguments"
body: <p>While trying to MOCK AWS Cognito Signup Method using <code>Moq</code> <code>C#</code></p>
  
  <pre><code> public async void Signup(UserTO user)
      {
  
          var req = new SignUpRequest()
          {
  
          };
          _cognito.Setup(m =&gt;
              m.SignUpAsync(It.IsAny&lt;SignUpRequest&gt;())) // LOE
              .ReturnsAsync(() =&gt;
              new SignUpResponse()
              {
  
              });
      }
  </code></pre>
  
  <p>But at the #LOE, getting the below error</p>
  
  <blockquote>
    <p>Error CS0854  An expression tree may not contain a call or invocation that uses optional arguments</p>
  </blockquote>
  
  <p>If I press f12 to get the definition of the SignUpAsync(), it looks as</p>
  
  <pre><code>Task&lt;SignUpResponse&gt; SignUpAsync(SignUpRequest request, CancellationToken cancellationToken = default(CancellationToken));
  </code></pre>
  
  <p><strong>What's causing this error &amp; how to get rid of this?</strong></p>
  
  <p>Thanks!</p>