protected virtual void BeforeEachTest() { _application = new TestUmbracoApplication(); _application.Start(); MigrationRecords = new DatabaseMigrationRecordRepository(_application.ApplicationContext.DatabaseContext.Database); MigrationConfiguration = new MigrationConfiguration(); _migrator = CreateMigrator(); }
private void RunMigrations(ApplicationContext applicationContext) { if (HttpContext.Current != null && HttpContext.Current.User == null) { HttpContext.Current.User = new GenericPrincipal(new GenericIdentity("0"), new string[0]); } var recordRepository = new DatabaseMigrationRecordRepository(applicationContext.DatabaseContext.Database); var migrationResolver = new MigrationResolver( new AppDomainAssemblyMigrationTypeProvider(LogManager.GetLogger(typeof(AppDomainAssemblyMigrationTypeProvider))) ); var context = new MigrationContext( new ServiceContextWrapper(applicationContext.Services), applicationContext.DatabaseContext.Database, applicationContext.ApplicationCache, recordRepository, new MigrationConfiguration() ); var logger = LogManager.GetLogger(typeof(UmbracoMigrator)); var migrator = new UmbracoMigrator(migrationResolver, context, logger); migrator.Run(); }