public SQLiteTestTable( SQLiteProcessor processor, string schemaName, params string[] columnDefinitions ) { _schemaName = schemaName; Connection = ( IDbConnection ) processor.Connection; Transaction = ( IDbTransaction ) processor.Transaction; Name = "Table" + Guid.NewGuid().ToString( "N" ); Create( columnDefinitions ); }
public void CallingProcessWithPerformDBOperationExpressionWhenInPreviewOnlyModeWillNotMakeDbChanges() { var output = new StringWriter(); var connection = new SQLiteConnection(IntegrationTestOptions.SqlLite.ConnectionString); var processor = new SQLiteProcessor( connection, new SQLiteGenerator(), new TextWriterAnnouncer(output), new ProcessorOptions { PreviewOnly = true }, new SQLiteDbFactory()); bool tableExists; try { var expression = new PerformDBOperationExpression { Operation = (con, trans) => { var command = con.CreateCommand(); command.CommandText = "CREATE TABLE ProcessTestTable (test int NULL) "; command.Transaction = trans; command.ExecuteNonQuery(); } }; processor.Process(expression); tableExists = processor.TableExists("", "ProcessTestTable"); } finally { processor.RollbackTransaction(); } tableExists.ShouldBeFalse(); Assert.That(output.ToString(), Is.StringContaining(@"/* Performing DB Operation */")); }
public void SetUp() { // This connection used in the tests var factory = new SQLiteDbFactory(); _connection = factory.CreateConnection("Data Source=:memory:;Version=3;New=True;"); _connection.Open(); _command = _connection.CreateCommand(); // SUT _processor = new SQLiteProcessor(_connection, new SQLiteGenerator(), new TextWriterAnnouncer(System.Console.Out), new ProcessorOptions(), factory); column = new Mock<ColumnDefinition>(); tableName = "NewTable"; tableNameThanMustBeEscaped = "123NewTable"; columnName = "ColumnName"; column.SetupGet(c => c.Name).Returns(columnName); column.SetupGet(c => c.IsNullable).Returns(true); column.SetupGet(c => c.Type).Returns(DbType.Int32); }
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 SQLiteSchemaDumper(SQLiteProcessor processor, IAnnouncer announcer) { Announcer = announcer; Processor = processor; }