public override void CallingConstraintExistsCanAcceptConstraintNameWithSingleQuote()
        {
            var constraintName = Quoter.QuoteConstraintName("c'1");

            using (var table = new SqlServerTestTable(Processor, null, "id int", string.Format("wibble int CONSTRAINT {0} CHECK(wibble > 0)", constraintName)))
                Processor.ConstraintExists(null, table.Name, "c'1").ShouldBeTrue();
        }
 public override void CallingIndexExistsCanAcceptSchemaNameWithSingleQuote()
 {
     using (var table = new SqlServerTestTable(Processor, "test'schema", "id int"))
     {
         var indexName = table.WithIndexOn("id");
         Processor.IndexExists("test'schema", table.Name, indexName).ShouldBeTrue();
     }
 }
 public void CallingDefaultValueExistsCanAcceptSchemaNameWithSingleQuote()
 {
     using (var table = new SqlServerTestTable(Processor, "test'schema", "id int"))
     {
         table.WithDefaultValueOn("id");
         Processor.DefaultValueExists("test'schema", table.Name, "id", 1).ShouldBeTrue();
     }
 }
 public override void CallingIndexExistsCanAcceptTableNameWithSingleQuote()
 {
     using (var table = new SqlServerTestTable("Test'Table", Processor, null, "id int"))
     {
         var indexName = table.WithIndexOn("id");
         Processor.IndexExists(null, table.Name, indexName).ShouldBeTrue();
     }
 }
 public override void CallingIndexExistsCanAcceptIndexNameWithSingleQuote()
 {
     const string columnSingleQuote = "i'd";
     using (var table = new SqlServerTestTable(Processor, null, Quoter.Quote(columnSingleQuote) +  " int"))
     {
         var indexName = table.WithIndexOn(columnSingleQuote);
         Processor.IndexExists(null, table.Name, indexName).ShouldBeTrue();
     }
 }
Exemplo n.º 6
0
        public void CanReadSchemaInfoWithNullable()
        {
            using (var table = new SqlServerTestTable(Processor, null, "id int NULL"))
            {
                IList<TableDefinition> defs = SchemaDumper.ReadDbSchema();

                var identityColumn = defs[0].Columns.First();
                identityColumn.Name.ShouldBe("id");
                identityColumn.IsNullable.ShouldBe(true);
            }
        }
Exemplo n.º 7
0
        public void CanReadBasicSchemaInfo()
        {
            // this is the fun part.. this test should fail until the schema reading code works
            // also assume the target database contains schema described in TestMigration
            using (var table = new SqlServerTestTable(Processor, null, "id int")) {
                IList<TableDefinition> defs = SchemaDumper.ReadDbSchema();

                SchemaTestWriter testWriter = new SchemaTestWriter();
                var output = GetOutput(testWriter, defs);
                string expectedMessage = testWriter.GetMessage(1, 1, 0, 0);

                output.ShouldBe(expectedMessage);
            }
        }
 public void CallingConstraintExistsReturnsFalseIfConstraintExistsInDifferentSchema()
 {
     using (var table = new SqlServerTestTable(Processor, "test_schema", "id int", "wibble int CONSTRAINT c1 CHECK(wibble > 0)"))
         Processor.ConstraintExists("test_schema2", table.Name, "c1").ShouldBeFalse();
 }
 public override void CallingTableExistsReturnsTrueIfTableExistsWithSchema()
 {
     using (var table = new SqlServerTestTable(Processor, "test_schema", "id int"))
         Processor.TableExists("test_schema", table.Name).ShouldBeTrue();
 }
 public void CallingTableExistsReturnsFalseIfTableExistsInDifferentSchema()
 {
     using (var table = new SqlServerTestTable(Processor, "test_schema", "id int"))
         Processor.TableExists("test_schema2", table.Name).ShouldBeFalse();
 }
 public override void CallingTableExistsCanAcceptSchemaNameWithSingleQuote()
 {
     using (var table = new SqlServerTestTable(Processor, "test'schema", "id int"))
         Processor.TableExists("test'schema", table.Name).ShouldBeTrue();
 }
 public override void CallingColumnExistsCanAcceptColumnNameWithSingleQuote()
 {
     var columnNameWithSingleQuote = Quoter.Quote("i'd");
     using (var table = new SqlServerTestTable(Processor, null, string.Format("{0} int", columnNameWithSingleQuote)))
         Processor.ColumnExists(null, table.Name, "i'd").ShouldBeTrue();
 }
 public override void CallingConstraintExistsCanAcceptSchemaNameWithSingleQuote()
 {
     using (var table = new SqlServerTestTable(Processor, "test'schema", "id int", "wibble int CONSTRAINT c1 CHECK(wibble > 0)"))
         Processor.ConstraintExists("test'schema", table.Name, "c1").ShouldBeTrue();
 }
 public void CallingColumnExistsReturnsTrueIfColumnExists()
 {
     using (var table = new SqlServerTestTable(Processor, null, "id int"))
         Processor.ColumnExists(null, table.Name, "id").ShouldBeTrue();
 }
 public void CallingColumnExistsReturnsTrueIfColumnExistsWithSchema()
 {
     using (var table = new SqlServerTestTable(Processor, "test_schema", "id int"))
         Processor.ColumnExists("test_schema", table.Name, "id").ShouldBeTrue();
 }
 public void CallingTableExistsReturnsTrueIfTableExists()
 {
     using (var table = new SqlServerTestTable(Processor, "id int"))
         Processor.TableExists(table.Name).ShouldBeTrue();
 }
 public void CallingColumnExistsReturnsFalseIfColumnDoesNotExist()
 {
     using (var table = new SqlServerTestTable(Processor, null, "id int"))
         Processor.ColumnExists(null, table.Name, "DoesNotExist").ShouldBeFalse();
 }
 public override void CallingConstraintExistsReturnsTrueIfConstraintExistsWithSchema()
 {
     using (var table = new SqlServerTestTable(Processor, "test_schema", "id int", "wibble int CONSTRAINT c1 CHECK(wibble > 0)"))
         Processor.ConstraintExists("test_schema", table.Name, "c1").ShouldBeTrue();
 }
 public override void CallingTableExistsCanAcceptTableNameWithSingleQuote()
 {
     using (var table = new SqlServerTestTable("Test'Table", Processor, null, "id int"))
         Processor.TableExists(null, table.Name).ShouldBeTrue();
 }
 public override void CallingIndexExistsReturnsTrueIfIndexExistsWithSchema()
 {
     using (var table = new SqlServerTestTable(Processor, "test_schema", "id int"))
     {
         var indexName = table.WithIndexOn("id");
         Processor.IndexExists("test_schema", table.Name, indexName).ShouldBeTrue();
     }
 }
 public override void CallingIndexExistsReturnsFalseIfIndexDoesNotExistWithSchema()
 {
     using (var table = new SqlServerTestTable(Processor, "test_schema", "id int"))
         Processor.IndexExists("test_schema", table.Name, "DoesNotExist").ShouldBeFalse();
 }
 public override void CallingIndexExistsReturnsFalseIfIndexDoesNotExist()
 {
     using (var table = new SqlServerTestTable(Processor, null, "id int"))
         Processor.IndexExists(null, table.Name, "DoesNotExist").ShouldBeFalse();
 }