Collection mock (result from ReturnCollection clause) does not support async queries due to the unimplemented IAsyncQueryProvider interface. The issue could be easily reproduced with the following simple test:
[Fact]
public void ShouldReturnEntity()
{
var db = Mock.Create<MyModel.MyModel>();
Mock.Arrange(() => db.SomeEntities).ReturnsCollection(someEntities);
var entity = db.SomeEntities.SingleAsync(x => x.Id == 1);
Assert.NotNull(entity);
}
The outcome is the the following exception:
System.InvalidOperationException The provider for the source 'IQueryable' doesn't implement 'IAsyncQueryProvider'. Only providers that implement 'IAsyncQueryProvider' can be used for Entity Framework asynchronous operations.