Converting IQueryable to implement IAsyncEnumerable
<p>I have a query in a method:</p>

<pre><code>private readonly IEntityReader&lt;Customer&gt; _reader;

public async Task&lt;IEnumerable&lt;Customer&gt;&gt; HandleAsync(GetCustomer query)
{
    var result = _reader.Query()
        .Include(customer =&gt; customer.Organization)
        .Where(customer =&gt; customer.Name == query.Name);

    return await result.ToListAsync();
}
</code></pre>

<p>Which has this unit-test:</p>

<pre><code>[Fact]
public async Task HandleGetCustomer_ReturnsCustomer_WhenNameMatches()
{
    // Arrange
    var customers = new List&lt;Customer&gt;()
    {
        new Customer
        {
            Id = new Guid("d4e749ba-6874-40f4-9134-6c9cc1bc95fe"),
            Name = "John Doe",
            Age = 18,
            Organization = new Organization
            {
                Id = new Guid("b2ba06c9-5c00-4634-b6f7-80167ea8c3f1"),
                Name = "TheCompany",
                Number = 42
            }
        },
        new Customer
        {
            Id = new Guid("0679ceb5-3d4f-41f3-a1b0-b167e1ac6d7e"),
            Name = "Another Guy",
            Age = 39,
            Organization = new Organization
            {
                Id = new Guid("b2ba06c9-5c00-4634-b6f7-80167ea8c3f1"),
                Name = "TheCompany",
                Number = 42
            }
        }
    }.AsQueryable();

    var entityReader = new Mock&lt;IEntityReader&lt;Customer&gt;&gt;(MockBehavior.Strict);
    entityReader.Setup(reader =&gt; reader.Query()).Returns(customers);

    var query = new GetCustomer
    {
        Name = "John Doe"
    };

    var handler = new HandleGetCustomer(entityReader.Object);

    // Act
    var result = await handler.HandleAsync(query);

    // Assert
    Assert.NotNull(result);
    Assert.True(result.Count() == 1);
    Assert.True(result.FirstOrDefault().Id == new Guid("d4e749ba-6874-40f4-9134-6c9cc1bc95fe"));
}
</code></pre>

<p>By apperently the call to <code>.ToListAsync();</code> fails because of:</p>

<blockquote>
  <p>The source IQueryable doesn't implement
  IAsyncEnumerable. Only sources that
  implement IAsyncEnumerable can be used for Entity Framework
  asynchronous operations.</p>
</blockquote>

<p>The extension method is a method from Entity Framework Core. </p>

<p>How can I convert my list of customers to the <code>IAsyncEnumerable</code>?</p>

<p>For reference, the <code>IEntityReader</code> interface is defined such as:</p>

<pre><code>public interface IEntityReader&lt;out TEntity&gt; where TEntity : Entity
{
    IQueryable&lt;TEntity&gt; Query();
}
</code></pre>