I'm not familiar with EntityFramework at all, and can't say what's going on for sure, since there's no stack trace with the NotImplementedException, but here's my guess:
You're seeing the exception raised from either the line that defines service
or the one that calls GetAllRequests
, not the A.Fake<DbSet<Request>>()
line.
It sounds to me like the innards of RequestReadService
(is that your class, I can't find it elsewhere?) or something it calls relies on the DbSet also implementing IQueryable.Provider
. Now. I'm not sure why that wouldn't already be present. Perhaps it's the explicit implementation that throws it off. The best I can suggest (and I've not tried this, given my complete lack of EF6 knowledge), is to maybe try explicitly adding the interface to the fake:
A.Fake<DbSet<Request>>(builder =>
builder.Implements(typeof (IQueryable<Result>)));
Although after I typed that, I read FakeItEasy issue 31, which I fear may apply, and so my idea may not work. Then again, if you're willing, give it a go. It may not take long.
Alternatively, in the short term, I'm not sure what other workarounds to suggest. Perhaps faking some of the interfaces that DbSet
implements instead of faking DbSet
itself?
Updated: after another question about this kind of thing, and actually grabbing EF6 so I could try it out, I created Issue 477 to track what appears to be the underlying problem here.