Following on the heels of my other question about mocking DbContext.Set I\'ve got another question about mocking EF Code First.
I now have a method for my update tha
Just like the other case, what you need is to add an additional level of indirection:
interface ISalesContext
{
IDbSet GetIDbSet();
void SetModified(object entity)
}
class SalesContext : DbContext, ISalesContext
{
public IDbSet GetIDbSet()
{
return Set();
}
public void SetModified(object entity)
{
Entry(entity).State = EntityState.Modified;
}
}
So, instead of calling the implementation, you just call SetModified.