public override void CanAlterSchema() { var expression = GeneratorTestHelper.GetAlterSchemaExpression(); var result = Generator.Generate(expression); result.ShouldBe(string.Empty); }
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 override void CanInsertData() { var expression = GeneratorTestHelper.GetInsertDataExpression(); var sql = generator.Generate(expression); var expected = "INSERT INTO [TestTable1] ([Id], [Name], [Website]) VALUES (1, 'Just''in', 'codethinked.com');"; expected += @" INSERT INTO [TestTable1] ([Id], [Name], [Website]) VALUES (2, 'Na\te', 'kohari.org')"; sql.ShouldBe(expected); }
public override void CanDropColumn() { var expression = GeneratorTestHelper.GetDeleteColumnExpression(); string sql = _generator.Generate(expression); sql.ShouldBe("ALTER TABLE [TestTable1] DROP COLUMN [TestColumn1]"); }
public override void CanCreateNullableColumnWithCustomDomainTypeAndCustomSchema() { var expression = GeneratorTestHelper.GetCreateColumnExpressionWithNullableCustomType(); expression.SchemaName = "TestSchema"; var result = Generator.Generate(expression); result.ShouldBe("ALTER TABLE [TestTable1] ADD COLUMN [TestColumn1] MyDomainType"); }
public override void CanCreateTable() { var expression = GeneratorTestHelper.GetCreateTableExpression(); var result = _generator.Generate(expression); result.ShouldBe("CREATE TABLE [TestTable1] ([TestColumn1] VARCHAR(255) NOT NULL, [TestColumn2] INTEGER 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 override void CanAddColumn() { var expression = GeneratorTestHelper.GetCreateColumnExpression(); var result = _generator.Generate(expression); result.ShouldBe("ALTER TABLE [TestTable1] ADD COLUMN [TestColumn1] VARCHAR(5) NOT NULL"); }
public void CanAlterSchemaInStrictMode() { Generator.compatabilityMode = Runner.CompatabilityMode.STRICT; Assert.Throws <DatabaseOperationNotSupportedException>(() => Generator.Generate(new CreateSchemaExpression())); }
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 CanAlterColumnWithCustomSchema() { var expression = GeneratorTestHelper.GetAlterColumnExpression(); expression.SchemaName = "TestSchema"; var result = Generator.Generate(expression); result.ShouldBe("ALTER TABLE [TestTable1] ALTER COLUMN [TestColumn1] VARCHAR(20) NOT NULL"); }
public override void CanCreateTableWithCustomColumnTypeWithCustomSchema() { var expression = GeneratorTestHelper.GetCreateTableExpression(); expression.Columns[1].Type = null; expression.Columns[1].CustomType = "[timestamp]"; expression.SchemaName = "TestSchema"; var result = Generator.Generate(expression); result.ShouldBe("CREATE TABLE [TestTable1] ([TestColumn1] VARCHAR(255) NOT NULL, [TestColumn2] [timestamp] NOT NULL)"); }