public void CanDropColumn() { //This does not work if column in used in constraint, index etc. var expression = GeneratorTestHelper.GetDeleteColumnExpression(); var sql = generator.Generate(expression); sql.ShouldBe("ALTER TABLE [TestTable1] DROP COLUMN [TestColumn1];"); }
public void CannotAlterASchema() { Assert.Throws <DatabaseOperationNotSupportedException>(() => _generator.Generate(new AlterSchemaExpression())); }
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] NVARCHAR(255) NOT NULL, [TestColumn2] [timestamp] NOT NULL, PRIMARY KEY ([TestColumn1]))"); }
public void AlterDefaultConstraintThrowsNotSupportedException() { var expression = GeneratorTestHelper.GetAlterDefaultConstraintExpression(); Assert.Throws <DatabaseOperationNotSupportedException>(() => Generator.Generate(expression)); }
public void CanAddColumn() { var expression = GeneratorTestHelper.GetCreateColumnExpression(); var sql = generator.Generate(expression); sql.ShouldBe("ALTER TABLE [TestTable1] ADD [TestColumn1] NVARCHAR(5) NOT NULL"); }
public override void CanAlterColumnWithCustomSchema() { var expression = GeneratorTestHelper.GetAlterColumnExpression(); expression.SchemaName = "TestSchema"; var result = Generator.Generate(expression); result.ShouldBe("ALTER TABLE [TestTable1] ALTER COLUMN [TestColumn1] NVARCHAR(20) NOT NULL"); }
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 void CannotCreateASchema() { Assert.Throws <DatabaseOperationNotSupportedExecption>(() => generator.Generate(new CreateSchemaExpression())); }
public void CanCreateTable() { var expression = GeneratorTestHelper.GetCreateTableExpression(); var sql = generator.Generate(expression); sql.ShouldBe("CREATE TABLE [TestTable1] ([TestColumn1] NVARCHAR(255) NOT NULL, [TestColumn2] INT NOT NULL)"); }
public override void CanCreateNullableColumnWithCustomDomainTypeAndCustomSchema() { var expression = GeneratorTestHelper.GetCreateColumnExpressionWithNullableCustomType(); expression.SchemaName = "TestSchema"; var result = Generator.Generate(expression); result.ShouldBe("ALTER TABLE [TestTable1] ADD [TestColumn1] MyDomainType"); }
public override void CanCreateForeignKeyWithCustomSchema() { var expression = GeneratorTestHelper.GetCreateForeignKeyExpression(); expression.ForeignKey.ForeignTableSchema = "TestSchema"; expression.ForeignKey.PrimaryTableSchema = "TestSchema"; var result = Generator.Generate(expression); result.ShouldBe("ALTER TABLE [TestTable1] ADD CONSTRAINT [FK_TestTable1_TestColumn1_TestTable2_TestColumn2] FOREIGN KEY ([TestColumn1]) REFERENCES [TestTable2] ([TestColumn2])"); }
public override void CanAlterSchema() { Assert.Throws <DatabaseOperationNotSupportedException>(() => Generator.Generate(GeneratorTestHelper.GetAlterSchemaExpression())); }