public void TestInit() { kernel = NinjectWebCommon.CreateKernel(); LiveDemoEfDbContext dbContext = kernel.Get <LiveDemoEfDbContext>(); dbContext.Categories.Add(dbCategory); dbContext.SaveChanges(); var category = dbContext.Categories.Single(); dbBook.CategoryId = category.Id; dbBook.Category = category; dbContext.Books.Add(dbBook); dbContext.SaveChanges(); }
public void TestCleanup() { LiveDemoEfDbContext dbContext = kernel.Get <LiveDemoEfDbContext>(); dbContext.Categories.Attach(dbCategory); dbContext.Categories.Remove(dbCategory); dbContext.SaveChanges(); }