I want to create a mocked DbContext using faked DbSets.
So I've created a class called FakeDbSet<T> which implements IDbSet<T>.
Now I've created a FakeDbContext which has those faked DbSet<T>s in it.
I've bound DbContext to FakeDbContext with Ninject like this:
Kernel.Bind<DbContext>().To<FakeDbContext>();
When I call my WebAPI project I'll get an SqlException that I don't have the permission to create the database.
This is my FakeDbContext:
public class FakeDbContext : DbContext
{
public virtual IDbSet<User> Users => new UserDbSet();
}
(Note: UserDbSet just fills the HashSet<User> with default data.)
How do I set my FakeDbContext to not create/interact with a real database? If I remove the : DbContext from the FakeDbContext Ninject says that it must be convertible to DbContext.