public override void CanAlterSchema() { var expression = GeneratorTestHelper.GetAlterSchemaExpression(); var result = Generator.Generate(expression); result.ShouldBe(string.Empty); }
public void CanAlterColumnInStrictMode() { var expression = GeneratorTestHelper.GetRenameColumnExpression(); Generator.compatabilityMode = CompatabilityMode.STRICT; Assert.Throws <DatabaseOperationNotSupportedException>(() => Generator.Generate(expression)); }
public override void CanCreateIndexWithCustomSchema() { var expression = GeneratorTestHelper.GetCreateIndexExpression(); expression.Index.SchemaName = "TestSchema"; var result = Generator.Generate(expression); result.ShouldBe("CREATE INDEX \"TestIndex\" ON \"TestTable1\" (\"TestColumn1\" ASC)"); }
public void CsvHeaderExceptionWillBeThrownForEmptyFile() { var stream = new MemoryStream(Encoding.UTF8.GetBytes(string.Empty)); var streamReader = new StreamReader(stream); _fileWrapper.Setup(m => m.Open(It.IsAny <string>())).Returns(streamReader); var config = new Configuration { InputFilename = "input.csv", OutputFilename = "output.sql" }; Assert.Throws <CsvHeaderException>(() => _generator.Generate(config)); }
public override void CanDeleteDataForAllRowsWithCustomSchema() { var expression = GeneratorTestHelper.GetDeleteDataAllRowsExpression(); expression.SchemaName = "TestSchema"; var result = Generator.Generate(expression); result.ShouldBe("DELETE FROM \"TestTable1\" WHERE 1 = 1"); }
public override void CanCreateTableWithCustomColumnTypeWithCustomSchema() { var expression = GeneratorTestHelper.GetCreateTableExpression(); expression.Columns[0].IsPrimaryKey = true; expression.Columns[1].Type = null; expression.Columns[1].CustomType = "timestamp"; expression.SchemaName = "TestSchema"; var result = Generator.Generate(expression); result.ShouldBe("CREATE TABLE \"TestTable1\" (\"TestColumn1\" TEXT NOT NULL, \"TestColumn2\" timestamp NOT NULL, PRIMARY KEY (\"TestColumn1\"))"); }
public override void CanCreateNullableColumnWithCustomDomainTypeAndCustomSchema() { var expression = GeneratorTestHelper.GetCreateColumnExpressionWithNullableCustomType(); expression.SchemaName = "TestSchema"; var result = Generator.Generate(expression); result.ShouldBe("ALTER TABLE \"TestSchema\".\"TestTable1\" ADD COLUMN \"TestColumn1\" MyDomainType"); }
public override void CanCreateForeignKeyWithCustomSchema() { var expression = GeneratorTestHelper.GetCreateForeignKeyExpression(); expression.ForeignKey.ForeignTableSchema = "TestSchema"; var result = Generator.Generate(expression); result.ShouldBe(string.Empty); }
public override void CanAlterColumnWithCustomSchema() { var expression = GeneratorTestHelper.GetAlterColumnExpression(); expression.SchemaName = "TestSchema"; var result = Generator.Generate(expression); result.ShouldBe(string.Empty); }
public override void CanAlterSchema() { var expression = GeneratorTestHelper.GetAlterSchemaExpression(); Assert.Throws <DatabaseOperationNotSupportedException>(() => Generator.Generate(expression)); }
public override void CanCreateForeignKeyWithCustomSchema() { var expression = GeneratorTestHelper.GetCreateForeignKeyExpression(); expression.ForeignKey.ForeignTableSchema = "TestSchema"; Assert.Throws <DatabaseOperationNotSupportedException>(() => Generator.Generate(expression)); }