-
-
Notifications
You must be signed in to change notification settings - Fork 802
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't Mock class inherited from DBContext #67
Comments
You should use Moq agains interfaces, right? Maybe try to public class ClassA : DbContext, IClassA public class IClassA: IDbContext [TestMethod] public void ShouldntThrowException() On Tue, Dec 10, 2013 at 6:30 PM, Drew Freyling notifications@github.comwrote:
|
Well yes that exists as a workaround but from what I can tell it should also work against a non-sealed class. |
Doesn't look like this is an issue since going from 6.0.2-beta1 to 6.0.2. Using @drewfreyling's code sample above, the Newest package versions are: <package id="EntityFramework" version="6.0.2" targetFramework="net45" />
<package id="Moq" version="4.2.1312.1622" targetFramework="net45" /> |
Sorry, we (the EF team) accidentally released 6.0.2-beta1 with internals visible to DynamicProxyGenAssembly2. This was fixed in 6.0.2. (See Work Item 1907.) |
Given the following nuget packages:
and code:
I'm getting an
ArgumentException
with "Type to mock must be an interface or an abstract or non-sealed class.". However I don't believe this is correct as neitherClassA
orDbContext
fit this criteria.Am I missing something?
The text was updated successfully, but these errors were encountered: