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 \"TestSchema\".\"TestTable1\" (\"TestColumn1\" ASC)"); }
public override void CanCreateSequenceWithCustomSchema() { var expression = GeneratorTestHelper.GetCreateSequenceExpression(); expression.Sequence.SchemaName = "TestSchema"; var result = Generator.Generate(expression); result.ShouldBe("CREATE SEQUENCE \"TestSchema\".\"Sequence\" INCREMENT BY 2 MINVALUE 0 MAXVALUE 100 START WITH 2 CACHE 10 CYCLE"); }
public void CanAlterColumnNoNullSettings() { var expression = GeneratorTestHelper.GetAlterColumnExpression(); expression.Column.IsNullable = null; var result = Generator.Generate(expression); result.ShouldBe("ALTER TABLE \"TestTable1\" MODIFY \"TestColumn1\" NVARCHAR2(20)"); }
public override void CanInsertData() { var expression = GeneratorTestHelper.GetInsertDataExpression(); string sql = generator.Generate(expression); string expected = "INSERT ALL INTO TestTable1 (Id, Name, Website) VALUES (1, 'Just''in', 'codethinked.com')"; expected += @" INTO TestTable1 (Id, Name, Website) VALUES (2, 'Na\te', 'kohari.org')"; expected += " SELECT 1 FROM DUAL"; sql.ShouldBe(expected); }
public override void CanAddColumn() { var expression = GeneratorTestHelper.GetCreateColumnExpression(); string sql = generator.Generate(expression); sql.ShouldBe("ALTER TABLE TestTable1 ADD TestColumn1 NVARCHAR2(5) NOT NULL"); }
public override void CanDropColumn() { var expression = GeneratorTestHelper.GetDeleteColumnExpression(); string sql = _generator.Generate(expression); sql.ShouldBe("ALTER TABLE \"TestTable1\" DROP COLUMN \"TestColumn1\""); }
public void CanCreateSequence() { var expression = new CreateSequenceExpression { Sequence = { Cache = 10, Cycle = true, Increment = 2, MaxValue = 100, MinValue = 0, Name = "Sequence", SchemaName = "Schema", StartWith = 2 } }; var sql = generator.Generate(expression); sql.ShouldBe("CREATE SEQUENCE \"Schema\".\"Sequence\" INCREMENT 2 MINVALUE 0 MAXVALUE 100 START WITH 2 CACHE 10 CYCLE"); }
public override void CanInsertData() { var expression = GeneratorTestHelper.GetInsertDataExpression(); string sql = quotedIdentiferGenerator.Generate(expression); string expected = "INSERT ALL INTO \"TestTable1\" (\"Id\", \"Name\", \"Website\") VALUES (1, 'Just''in', 'codethinked.com')"; expected += " INTO \"TestTable1\" (\"Id\", \"Name\", \"Website\") VALUES (2, 'Na\\te', 'kohari.org')"; expected += " SELECT 1 FROM DUAL"; sql.ShouldBe(expected); sql = generator.Generate(expression); sql.ShouldBe(expected.Replace("\"", "")); }
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 CanAlterColumnWithCustomSchema() { var expression = GeneratorTestHelper.GetAlterColumnExpression(); expression.SchemaName = "TestSchema"; var result = Generator.Generate(expression); result.ShouldBe("ALTER TABLE \"TestTable1\" MODIFY \"TestColumn1\" NVARCHAR2(20) NOT NULL"); }
public override void CanCreateTableWithCustomColumnTypeWithCustomSchema() { var expression = GeneratorTestHelper.GetCreateTableExpression(); expression.Columns[0].IsPrimaryKey = true; expression.Columns[1].Type = null; expression.Columns[1].CustomType = "BINARY_DOUBLE"; expression.SchemaName = "TestSchema"; var result = Generator.Generate(expression); result.ShouldBe("CREATE TABLE \"TestTable1\" (\"TestColumn1\" NVARCHAR2(255) NOT NULL, \"TestColumn2\" BINARY_DOUBLE NOT NULL, PRIMARY KEY (\"TestColumn1\"))"); }
public override void CanCreateTable() { var expression = GeneratorTestHelper.GetCreateTableExpression(); string sql = _generator.Generate(expression); sql.ShouldBe("CREATE TABLE TestTable1 (TestColumn1 NVARCHAR2(255) NOT NULL, TestColumn2 NUMBER(10,0) NOT NULL)"); }
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 CanCreateNullableColumnWithCustomDomainTypeAndCustomSchema() { var expression = GeneratorTestHelper.GetCreateColumnExpressionWithNullableCustomType(); expression.SchemaName = "TestSchema"; var result = Generator.Generate(expression); result.ShouldBe("ALTER TABLE \"TestSchema\".\"TestTable1\" ADD \"TestColumn1\" MyDomainType"); }
public void ThrowsExceptionCreateTableWithIdentity() { var customGenerator = new OracleGenerator(new OracleColumn { ThrowExceptionIdentityNotSupported = true}, new OracleQuoter()); Assert.Throws<DatabaseOperationNotSupportedExecption>(() => customGenerator.Generate(GeneratorTestHelper.GetCreateTableWithAutoIncrementExpression())); }