title: Setup method in Moq, ambiguous call
body: <p>I'm trying to use Moq to mock the interface:</p>
  
  <pre><code>public interface IMatchSetupRepository
  {
      IEnumerable&lt;MatchSetup&gt; GetAll();
  }
  </code></pre>
  
  <p>and I'm doing:</p>
  
  <pre><code>var matchSetupRepository = new Mock&lt;IMatchSetupRepository&gt;();
  matchSetupRepository
      .Setup(ms =&gt; ms.GetAll())
      .Returns(null);
  </code></pre>
  
  <p>But it doesn't even compile because of the error:</p>
  
  <blockquote>
    <p>error CS0121: The call is ambiguous between the following methods or
    properties:
    &#39;Moq.Language.IReturns&lt;Data.Contract.IMatchSetupRepository,System.Collections.Generic.IEnumerable&lt;Data.Model.MatchSetup&gt;&gt;.Returns(System.Collections.Generic.IEnumerable&lt;Data.Model.MatchSetup&gt;)&#39;
    and
    &#39;Moq.Language.IReturns&lt;Data.Contract.IMatchSetupRepository,System.Collections.Generic.IEnumerable&lt;Data.Model.MatchSetup&gt;&gt;.Returns(System.Func&lt;System.Collections.Generic.IEnumerable&lt;Data.Model.MatchSetup&gt;&gt;)&#39;</p>
  </blockquote>
  
  <p>I'm using: </p>
  
  <blockquote>
    <p>Moq.dll, v4.0.20926</p>
  </blockquote>