DbContext implement interface to leverage testability
Posted: Wed 21 Jan 2015 19:51
Hello
Is there a way of making my context implement an interface? It would certainly help me a lot by increasing testability, since I could, then, create FakeContext to use in my unit tests.
I tried doing so by creating another partial Context class and implementing my hard coded interface. But the generated context uses the DbSet concrete class instead of IDbSet abstraction, which makes my interface useless.
Please, let me know if I wasn't clear.
Thank you for your support.
Is there a way of making my context implement an interface? It would certainly help me a lot by increasing testability, since I could, then, create FakeContext to use in my unit tests.
I tried doing so by creating another partial Context class and implementing my hard coded interface. But the generated context uses the DbSet concrete class instead of IDbSet abstraction, which makes my interface useless.
Please, let me know if I wasn't clear.
Thank you for your support.