예제 #1
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         db.Dispose();
     }
     base.Dispose(disposing);
 }
예제 #2
0
        public TestContext Build()
        {
            var dbInitializer = new TestPhotosDbInitializer(_albums);

            Database.SetInitializer(dbInitializer);

            PhotosDbContext context = null;

            try
            {
                context = new PhotosDbContext();
                context.Database.Initialize(force: true);
                return(new TestContext(context));
            }
            catch (Exception)
            {
                context?.Dispose();
                throw;
            }
        }