'EF Core xunit assert whether .Include was called

I've got extension methods in .net core that effectively dynamically evaluate stuff, and will call .Include() on an IQueryable<T>. I'd like to build unit tests that test that.

Because I'm simply trying to validate .Include is called, I don't think I necessarily need to have a real db context present, but I'm failing to understand how I would assert whether my returned IQueryable<T> has called .Include().

I am aware I could probably use an InMemory provider and literally just test that the returned values returned the specified .Included properties, but I'd like to avoid hooking up to a db (InMemory or otherwise)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source