title: How do I Moq a method that has an optional argument in its signature without explicitly specifying it or using an overload?
body: <p>Given the following interface:</p>
  
  <pre><code>public interface IFoo
  {
      bool Foo(string a, bool b = false);
  }
  </code></pre>
  
  <p>Attempting to mock it using Moq:</p>
  
  <pre><code>var mock = new Mock&lt;IFoo&gt;();
  mock.Setup(mock =&gt; mock.Foo(It.IsAny&lt;string&gt;())).Returns(false);
  </code></pre>
  
  <p>gives the following error at compile time:</p>
  
  <blockquote>
    <p>An expression tree may not contain a call or invocation that uses optional arguments</p>
  </blockquote>
  
  <p>I've found the issue above raised as an <a href="http://code.google.com/p/moq/issues/detail?id=284">enhancement</a> in Moq's list of issues and it appears to be assigned to the 4.5 release (whenever that is).</p>
  
  <p>My question is: what should I do given that the above is not going to be fixed anytime soon? Are my options only to either explicitly set the default value of the optional parameter every time I mock it (which kind of defeats the point of specifying one in the first place) or to create an overload without the bool (like what I would have done prior to C# 4)?</p>
  
  <p>Or has anyone come across a more clever way to overcome this issue?</p>