title: How to overcome the IQueryable doesn't implement IAsyncQueryProvider while Mocking the FromSql() method?
body: <p>I'm using the below link for mocking the FromSql method in x unit
  <a href="https://stackoverflow.com/questions/40726638/how-could-i-mock-the-fromsql-method">How could I Mock the FromSql() method?</a></p>
  
  <p>I'm getting the below error for the method which uses <code>FirstOrDefaultAsync</code></p>
  
  <blockquote>
    <p>The provider for the source IQueryable doesn't implement
    IAsyncQueryProvider. Only providers that implement IAsyncQueryProvider
    can be used for Entity Framework asynchronous operations.</p>
  </blockquote>
  
  <p>But it is working fine for the <code>ToListAsync</code> method.</p>
  
  <pre class="lang-cs prettyprint-override"><code>SpAsyncEnumerableQueryable&lt;Model&gt; models = new SpAsyncEnumerableQueryable&lt;Model&gt;();
  models.Add(new Model { ItemId = 1 });
  
  MyDbContext.Model = MyDbContext.Model.MockFromSql(models);
  </code></pre>
  
  <p>Below is the Actual method c#</p>
  
  <pre><code>return await this.MyDbContext.Model
      .FromSql("TestProc", 1, 1)
      .FirstOrDefaultAsync()
      .ConfigureAwait(false);
  </code></pre>
  
  <p>Getting error at <code>FirstOrDefaultAsync</code></p>
  
  <blockquote>
    <p>The provider for the source IQueryable doesn't implement
    IAsyncQueryProvider. Only providers that implement IAsyncQueryProvider
    can be used for Entity Framework asynchronous operations.</p>
  </blockquote>