protected static void ExecuteWithPostgres(Action <IMigrationProcessor> test, IntegrationTestOptions.DatabaseServerOptions serverOptions, Boolean tryRollback) { if (!serverOptions.IsEnabled) { return; } var connection = new NpgsqlConnection(serverOptions.ConnectionString); var processor = new PostgresProcessor(connection, new PostgresGenerator(), new TextWriterAnnouncer(System.Console.Out), new ProcessorOptions()); test(processor); }
private static void ExecuteWithSqlServer(IntegrationTestOptions.DatabaseServerOptions serverOptions, TextWriterAnnouncer announcer, SqlServer2005Generator generator, Action <IMigrationProcessor> test, bool tryRollback) { using (var connection = new SqlConnection(serverOptions.ConnectionString)) { var processor = new SqlServerProcessor(connection, generator, announcer, new ProcessorOptions(), new SqlServerDbFactory()); test(processor); if (tryRollback && !processor.WasCommitted) { processor.RollbackTransaction(); } } }
protected static void ExecuteWithMySql(Action <IMigrationProcessor> test, IntegrationTestOptions.DatabaseServerOptions serverOptions) { if (!serverOptions.IsEnabled) { return; } var announcer = new TextWriterAnnouncer(System.Console.Out); announcer.Heading("Testing Migration against MySQL Server"); using (var connection = new MySqlConnection(serverOptions.ConnectionString)) { var processor = new MySqlProcessor(connection, new MySqlGenerator(), announcer, new ProcessorOptions(), new MySqlDbFactory()); test(processor); } }
protected static void ExecuteWithFirebird(Action <IMigrationProcessor> test, IntegrationTestOptions.DatabaseServerOptions serverOptions) { if (!serverOptions.IsEnabled) { return; } var announcer = new TextWriterAnnouncer(System.Console.Out); announcer.ShowSql = true; announcer.Heading("Testing Migration against Firebird Server"); if (!System.IO.File.Exists("fbtest.fdb")) { FbConnection.CreateDatabase(serverOptions.ConnectionString); } using (var connection = new FbConnection(serverOptions.ConnectionString)) { var options = FirebirdOptions.AutoCommitBehaviour(); var processor = new FirebirdProcessor(connection, new FirebirdGenerator(options), announcer, new ProcessorOptions(), new PostgresDbFactory(), options); try { test(processor); } catch (Exception e) { if (!processor.WasCommitted) { processor.RollbackTransaction(); } throw e; } if (!processor.WasCommitted) { processor.RollbackTransaction(); } connection.Close(); } }
protected static void ExecuteWithSqlite(Action <IMigrationProcessor> test, IntegrationTestOptions.DatabaseServerOptions serverOptions) { if (!serverOptions.IsEnabled) { return; } var announcer = new TextWriterAnnouncer(System.Console.Out); announcer.Heading("Testing Migration against SQLite"); var factory = new SqliteDbFactory(); using (var connection = factory.CreateConnection(serverOptions.ConnectionString)) { var processor = new SqliteProcessor(connection, new SqliteGenerator(), announcer, new ProcessorOptions(), factory); test(processor); } }
public TemporaryDatabase(IntegrationTestOptions.DatabaseServerOptions connectionOptions, FirebirdLibraryProber prober) { if (!connectionOptions.IsEnabled) { Assert.Ignore(); } DbFileName = Path.GetTempFileName(); _connectionString = new Lazy <string>(() => { var csb = new FbConnectionStringBuilder(connectionOptions.ConnectionString) { Pooling = false, Database = DbFileName, }; return(prober.CreateDb(csb)); }); }
protected static void ExecuteWithPostgres(Action <IMigrationProcessor> test, IntegrationTestOptions.DatabaseServerOptions serverOptions, Boolean tryRollback) { if (!serverOptions.IsEnabled) { return; } var announcer = new TextWriterAnnouncer(System.Console.Out); announcer.Heading("Testing Migration against Postgres"); using (var connection = new NpgsqlConnection(serverOptions.ConnectionString)) { var processor = new PostgresProcessor(connection, new PostgresGenerator(), new TextWriterAnnouncer(System.Console.Out), new ProcessorOptions(), new PostgresDbFactory()); test(processor); if (!processor.WasCommitted) { processor.RollbackTransaction(); } } }