public void CallingDefaultValueExistsCanAcceptSchemaNameWithSingleQuote()
 {
     using (var table = new PostgresTestTable(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 PostgresTestTable("Test'Table", Processor, null, "id int"))
            {
                var idxName = string.Format("\"idx_{0}\"", Quoter.UnQuote(table.Name));

                var cmd = table.Connection.CreateCommand();
                cmd.Transaction = table.Transaction;
                cmd.CommandText = string.Format("CREATE INDEX {0} ON {1} (id)", idxName, table.Name);
                cmd.ExecuteNonQuery();

                Processor.IndexExists(null, table.Name, idxName).ShouldBeTrue();
            }
        }
        public void CanReadData()
        {
            using (var table = new PostgresTestTable(Processor, null, "id int"))
            {
                AddTestData(table);

                DataSet ds = Processor.Read("SELECT * FROM {0}", table.Name);

                ds.ShouldNotBeNull();
                ds.Tables.Count.ShouldBe(1);
                ds.Tables[0].Rows.Count.ShouldBe(3);
                ds.Tables[0].Rows[2][0].ShouldBe(2);
            }
        }
        public void CallingIndexExistsReturnsTrueIfIndexExistsWithSchema()
        {
            using (var table = new PostgresTestTable(Processor, "TestSchema", "id int"))
            {
                var idxName = string.Format("\"idx_{0}\"", quoter.UnQuote(table.Name));

                var cmd = table.Connection.CreateCommand();
                cmd.Transaction = table.Transaction;
                cmd.CommandText = string.Format("CREATE INDEX {0} ON {1} (id)", idxName, table.NameWithSchema);
                cmd.ExecuteNonQuery();

                Processor.IndexExists("TestSchema", table.Name, idxName).ShouldBeTrue();
            }
        }
 public override void CallingColumnExistsCanAcceptTableNameWithSingleQuote()
 {
     using (var table = new PostgresTestTable("Test'Table", Processor, null, "id int"))
         Processor.ColumnExists(null, table.Name, "id").ShouldBeTrue();
 }
 public void CallingTableExistsReturnsFalseIfTableExistsInDifferentSchema()
 {
     using (var table = new PostgresTestTable(Processor, "TestSchema1", "id int"))
         Processor.TableExists("TestSchema2", table.Name).ShouldBeFalse();
 }
        public void CanReadTableDataWithSchema()
        {
            using (var table = new PostgresTestTable(Processor, "TestSchema", "id int"))
            {
                AddTestData(table);

                DataSet ds = Processor.ReadTableData("TestSchema", table.Name);

                ds.ShouldNotBeNull();
                ds.Tables.Count.ShouldBe(1);
                ds.Tables[0].Rows.Count.ShouldBe(3);
                ds.Tables[0].Rows[2][0].ShouldBe(2);
            }
        }
 public void CallingColumnExistsReturnsFalseIfColumnDoesNotExistWithSchema()
 {
     using (var table = new PostgresTestTable(Processor, "TestSchema", "id int"))
         Processor.ColumnExists("TestSchema", table.Name, "DoesNotExist").ShouldBeFalse();
 }
 public void CallingColumnExistsCanAcceptColumnNameWithSingleQuote()
 {
     var columnNameWithSingleQuote = quoter.Quote("i'd");
     using (var table = new PostgresTestTable(Processor, null, string.Format("{0} int", columnNameWithSingleQuote)))
         Processor.ColumnExists(null, table.Name, "i'd").ShouldBeTrue();
 }
 public void CallingTableExistsReturnsTrueIfTableExists()
 {
     using (var table = new PostgresTestTable(Processor, null, "id int"))
         Processor.TableExists(null, table.Name).ShouldBeTrue();
 }
        public void CanReadTableData()
        {
            using (var table = new PostgresTestTable(Processor, null, "id int"))
            {
                AddTestData(table);

                DataSet ds = ((DataSetContainer)Processor.ReadTableData(null, table.Name)).DataSet;

                ds.ShouldNotBeNull();
                ds.Tables.Count.ShouldBe(1);
                ds.Tables[0].Rows.Count.ShouldBe(3);
                ds.Tables[0].Rows[2][0].ShouldBe(2);
            }
        }
        public void CanReadDataWithSchema()
        {
            using (var table = new PostgresTestTable(Processor, "TestSchema", "id int"))
            {
                AddTestData(table);

                DataSet ds = ((DataSetContainer)Processor.Read("SELECT * FROM {0}", table.NameWithSchema)).DataSet;

                ds.ShouldNotBeNull();
                ds.Tables.Count.ShouldBe(1);
                ds.Tables[0].Rows.Count.ShouldBe(3);
                ds.Tables[0].Rows[2][0].ShouldBe(2);
            }
        }
 public override void CallingIndexExistsReturnsFalseIfIndexDoesNotExistWithSchema()
 {
     using (var table = new PostgresTestTable(Processor, "TestSchema", "id int"))
         Processor.IndexExists("TestSchema", table.Name, "DoesNotExist").ShouldBeFalse();
 }
 public override void CallingColumnExistsReturnsTrueIfColumnExistsWithSchema()
 {
     using (var table = new PostgresTestTable(Processor, "TestSchema", "id int"))
         Processor.ColumnExists("TestSchema", table.Name, "id").ShouldBeTrue();
 }
 public void CallingTableExistsCanAcceptSchemaNameWithSingleQuote()
 {
     using (var table = new PostgresTestTable(Processor, "Test'Schema", "id int"))
         Processor.TableExists("Test'Schema", table.Name).ShouldBeTrue();
 }
 public void CallingTableExistsCanAcceptTableNameWithSingleQuote()
 {
     using (var table = new PostgresTestTable(null, "TestSingle'Quote", Processor, "id int"))
         Processor.TableExists(null, table.Name).ShouldBeTrue();
 }
 public override void CallingConstraintExistsCanAcceptConstraintNameWithSingleQuote()
 {
     using (var table = new PostgresTestTable(Processor, null, "id int", string.Format("wibble int CONSTRAINT {0} CHECK(wibble > 0)", Quoter.QuoteConstraintName("c'1"))))
         Processor.ConstraintExists(null, table.Name, "c'1").ShouldBeTrue();
 }
 public void CallingTableExistsReturnsTrueIfTableExistsWithSchema()
 {
     using (var table = new PostgresTestTable(Processor, "TestSchema", "id int"))
         Processor.TableExists("TestSchema", table.Name).ShouldBeTrue();
 }
 public override void CallingConstraintExistsReturnsFalseIfConstraintDoesNotExist()
 {
     using (var table = new PostgresTestTable(Processor, null, "id int"))
         Processor.ConstraintExists(null, table.Name, "DoesNotExist").ShouldBeFalse();
 }
 public void CallingColumnExistsCanAcceptTableNameWithSingleQuote()
 {
     using (var table = new PostgresTestTable("TestSchema", "TestSingle'Quote", Processor, "id int"))
         Processor.ColumnExists("TestSchema", table.Name, "id").ShouldBeTrue();
 }
 public override void CallingConstraintExistsReturnsTrueIfConstraintExistsWithSchema()
 {
     using (var table = new PostgresTestTable(Processor, "TestSchema", "id int", "wibble int CONSTRAINT c1 CHECK(wibble > 0)"))
         Processor.ConstraintExists("TestSchema", table.Name, "c1").ShouldBeTrue();
 }
 private void AddTestData(PostgresTestTable table)
 {
     for (int i = 0; i < 3; i++)
     {
         var cmd = table.Connection.CreateCommand();
         cmd.Transaction = table.Transaction;
         cmd.CommandText = string.Format("INSERT INTO {0} (id) VALUES ({1})", table.NameWithSchema, i);
         cmd.ExecuteNonQuery();
     }
 }
 public void CallingConstraintExistsCanAcceptTableNameWithSingleQuote()
 {
     using (var table = new PostgresTestTable("TestSchema", "TestSingle'Quote", Processor, "id int", "wibble int CONSTRAINT c1 CHECK(wibble > 0)"))
         Processor.ConstraintExists("TestSchema", table.Name, "c1").ShouldBeTrue();
 }
 public void CallingConstraintExistsReturnsFalseIfConstraintExistsInDifferentSchema()
 {
     using (var table = new PostgresTestTable(Processor, "TestSchema1", "id int", "wibble int CONSTRAINT c1 CHECK(wibble > 0)"))
         Processor.ConstraintExists("TestSchema2", table.Name, "c1").ShouldBeFalse();
 }
 public void CallingContraintExistsReturnsTrueIfConstraintExists()
 {
     using (var table = new PostgresTestTable(Processor, null, "id int", "wibble int CONSTRAINT c1 CHECK(wibble > 0)"))
         Processor.ConstraintExists(null, table.Name, "c1").ShouldBeTrue();
 }
 public void CallingIndexExistsReturnsFalseIfIndexDoesNotExist()
 {
     using (var table = new PostgresTestTable(Processor, null, "id int"))
         Processor.IndexExists(null, table.Name, "DoesNotExist").ShouldBeFalse();
 }
 public override void CallingColumnExistsCanAcceptColumnNameWithSingleQuote()
 {
     var columnNameWithSingleQuote = Quoter.Quote("i'd");
     using (var table = new PostgresTestTable(Processor, null, columnNameWithSingleQuote + " int"))
         Processor.ColumnExists(null, table.Name, "i'd").ShouldBeTrue();
 }