Nhibernate .Fetch calls fail on a mocked session
I love NHibernate (and NHibernate.Linq). I don't prematurely optimize, but sometimes I'll hit a really nasty N+1 issue. The recommended fix for the N+1 is to use NH's Fetch extension method. The problem arises when I create a Mock of the ISession . I'll create a List<User> and set my mock to return the list whenever someone calls _session.Query<User>() . When I add a Fetch call to the query (i.e. _session.Query<User>().Fetch(u => u.Address) , I get the following error message: There is no method 'Fetch' on type 'NHibernate.Linq.EagerFetchingExtensionMethods' that matches the specified