Esempio n. 1
0
        public override void CanAlterSchema()
        {
            var expression = GeneratorTestHelper.GetAlterSchemaExpression();

            var result = Generator.Generate(expression);

            result.ShouldBe(string.Empty);
        }
Esempio n. 2
0
        public override void CanCreateIndexWithCustomSchema()
        {
            var expression = GeneratorTestHelper.GetCreateIndexExpression();

            expression.Index.SchemaName = "TestSchema";

            var result = Generator.Generate(expression);

            result.ShouldBe("CREATE INDEX TestSchema.TestIndex ON TestSchema.TestTable1 (TestColumn1)");
        }
Esempio n. 3
0
        public override void CanCreateSequenceWithCustomSchema()
        {
            var expression = GeneratorTestHelper.GetCreateSequenceExpression();

            expression.Sequence.SchemaName = "TestSchema";

            var result = Generator.Generate(expression);

            result.ShouldBe("CREATE SEQUENCE TestSchema.Sequence INCREMENT 2 MINVALUE 0 MAXVALUE 100 START WITH 2 CACHE 10 CYCLE");
        }
        public void CanCreateAutoIncrementColumnForInt64()
        {
            var expression = GeneratorTestHelper.GetCreateTableWithAutoIncrementExpression();

            expression.Columns[0].Type = DbType.Int64;

            var result = Generator.Generate(expression);

            result.ShouldBe("CREATE TABLE TestTable1 (TestColumn1 BIGINT NOT NULL AS IDENTITY, TestColumn2 INTEGER NOT NULL)");
        }
Esempio n. 5
0
        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 TestSchema.TestTable1 ADD CONSTRAINT TestSchema.FK_TestTable1_TestColumn1_TestTable2_TestColumn2 FOREIGN KEY (TestColumn1) REFERENCES TestSchema.TestTable2 (TestColumn2)");
        }
Esempio n. 6
0
        public override void CanDeleteDataForAllRowsWithCustomSchema()
        {
            var expression = GeneratorTestHelper.GetDeleteDataAllRowsExpression();

            expression.SchemaName = "TestSchema";

            var result = Generator.Generate(expression);

            result.ShouldBe("DELETE FROM TestSchema.TestTable1");
        }
        public override void CanCreateTableWithCustomColumnTypeWithCustomSchema()
        {
            var expression = GeneratorTestHelper.GetCreateTableExpression();

            expression.Columns[0].IsPrimaryKey = true;
            expression.Columns[1].Type         = null;
            expression.Columns[1].CustomType   = "json";
            expression.SchemaName = "TestSchema";

            var result = Generator.Generate(expression);

            result.ShouldBe("CREATE TABLE TestSchema.TestTable1 (TestColumn1 DBCLOB(1048576) CCSID 1200 NOT NULL, TestColumn2 json NOT NULL, PRIMARY KEY (TestColumn1))");
        }