title: How to mock LINQ to Entities helpers such as 'SqlFunctions.StringConvert()'
body: <p>I am using EF 4 and is trying to unit test the follow line using Moq:</p>
  
  <pre><code>var convertError = models
               .Where(x =&gt; SqlFunctions.StringConvert((decimal?) (x.convert ?? 0)) == "0")
               .Any();
  </code></pre>
  
  <p>and it seems like <code>SqlFunctions.StringConvert()</code> will throw if it detects the context is mocked. </p>
  
  <p>It gives an error saying:</p>
  
  <blockquote>
    <p>This function can only be invoked from LINQ to Entities</p>
  </blockquote>
  
  <p>Is it possible to tell <code>SqlFunctions.StringConvert</code> to return a mock object so I can get rid of this error?</p>