public ExtractColumn(IDatabaseAdapter src, IDatabaseAdapter dest, ITableConversionRules rules)
 {
     this.src = src;
     this.dest = dest;
     this.rules = rules;
     this.destGenerator = new SqlGenerator(dest);
     this.ForeignKeyResolver = new ForeignKeyResolver();
 }
        public void Test_Select_Statement_Generation()
        {
            // arrange
            var schema = new DataTable();
            schema.Columns.Add("COLUMN_NAME");
            schema.Rows.Add(new object[] { "field1" });
            schema.Rows.Add(new object[] { "field2" });
            schema.Rows.Add(new object[] { "field3" });
            conn.Setup(x => x.GetSchema("Columns", new [] { null, null, "testTable", null }))
                .Returns(schema);
            var generator = new SqlGenerator(conn.Object);

            // act
            var select = generator.GenerateSelect("testTable");

            // assert
            Assert.AreEqual("SELECT field1, field2, field3 FROM testTable", select);
        }
        public void Generate_Select_With_Where()
        {
            // arrange
            var conn = new Mock<DbConnection>();
            var schema = new DataTable();
            schema.Columns.Add("COLUMN_NAME");
            schema.Rows.Add(new object[] { "field1" });
            schema.Rows.Add(new object[] { "field2" });
            conn.Setup(x => x.GetSchema("Columns", new [] { null, null, "testTable", null }))
                .Returns(schema);
            var generator = new SqlGenerator(conn.Object);

            // act
            var select = generator.GenerateSelect("testTable", "tblContactLoginID = 'ahaley'");

            // assert
            Assert.AreEqual(
                "SELECT field1, field2 FROM testTable WHERE tblContactLoginID = 'ahaley'",
                select);
        }
 public SqlGeneratorTest()
 {
     generator = new SqlGenerator(conn.Object);
 }