I create a unit test that calls the task creation method. The task creation method calls some mocking external object, which is the goal of my test, but inside my test method there is also a call SaveChangesthat saves my task. What I'm trying to do is subclass the class DbContextinternally System.Data.Entityso that the method SaveChangesno longer accesses the database.
I added a fake build for System.Data.Entity, but when I use System.Data.Entity.Fakes it says "cannot resolve the" Fakes "character, although I can access System.Data.Fakes(but I didn’t add a fake build for System.Data)
I messed up other methods in the context of my entities, but I cannot fake the SaveChanges method for my object, since the method inherits from DbContext.
ShimDBEntities.AllInstances.SaveChanges = (x) => { ... };
the top of the code says: "Cannot resolve the 'Save Changes' symbol.
So how can I trim DbContext using Microsoft Fakes?
source
share