I am using Entity Framework and that is where my problem is, but probably it is not relevant since I think this is a general C # question.
I have a MyContext class that has many DbSet<T> properties.
To unit test it, I edited MyContext, so they IDbSet<T> instead and mock him. IDbSet<T> is part of the Entity Framework, and DbSet implements it, so they are almost identical.
Everything works fine, because I can do IDbSet<T> all I could do to DbSet<T>
All but one - DbSet has a method called SqlQuery(..) , which I also want to be able to call from my IDbSet .
Since I cannot change DbSet or IDbSet , this leaves me with a riddle. I canβt understand how I can do this, so my IDbSet may have a SearchQuery(..) method added to it in some logical way.
It makes sense? I'm very confused, so maybe I skipped something very simple, like copy and paste IDbSet and rename it and add SearchQuery() . Any ideas?
source share