I have an Repository. For Unitest I use an Fake-Repository that returns a FakeDbSet (Implementation found on internet) with IDbAsyncEnumerable-Implementation.
My Fake-Methode locks like:
public IQueryable<Foo> GetAll()
{
var foo=new Foo();
return new FakeDbSet<Foo>() { foo }.AsQueryable();
}
So this Code works in UnitTest:
Foo[] foo = await MyRepo.GetAll().ToArrayAsync();
but this don't
Foo[] foo = await MyRepo.GetAll().Where(x=>x.Id==1).ToArrayAsync();
Error: The source IQueryable doesn't implement IDbAsyncEnumerable.
Because the Where-Methode returns IQueryable.
What can I do?
Aucun commentaire:
Enregistrer un commentaire