예제 #1
0
        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();
        }
예제 #2
0
        public void TestCleanup()
        {
            LiveDemoEfDbContext dbContext = kernel.Get <LiveDemoEfDbContext>();

            dbContext.Categories.Attach(dbCategory);
            dbContext.Categories.Remove(dbCategory);

            dbContext.SaveChanges();
        }