Example #1
0
        public void RenderTableFromClause()
        {
            Table           table           = new Table("Table1");
            TableFromClause tableFromClause = new TableFromClause(table);

            Assert.AreEqual("[Table1]", sqlClientRenderer.Render(tableFromClause));
        }
Example #2
0
        public void RenderTableFromClauseWithAlias()
        {
            Table           table           = new Table("Table1");
            TableFromClause tableFromClause = new TableFromClause(table, "Table1Alias");

            Assert.AreEqual("[Table1] Table1Alias", sqlClientRenderer.Render(tableFromClause));
        }
Example #3
0
        public void CreateTableFromClauseWithAlias()
        {
            Table           table           = new Table("Table1");
            TableFromClause tableFromClause = new TableFromClause(table, "Table1Alias");

            Assert.AreEqual(table, tableFromClause.Table);
            Assert.AreEqual("Table1Alias", tableFromClause.Alias);
        }
Example #4
0
        public void CreateTableFromClause()
        {
            Table           table           = new Table("Table1");
            TableFromClause tableFromClause = new TableFromClause(table);

            Assert.AreEqual(table, tableFromClause.Table);
            Assert.IsNull(tableFromClause.Alias);
        }
Example #5
0
        public void RenderFromClauses()
        {
            Table           table1      = new Table("Table1");
            Table           table2      = new Table("Table2");
            TableFromClause fromClause1 = new TableFromClause(table1);
            TableFromClause fromClause2 = new TableFromClause(table2);
            FromClauses     fromClauses = new FromClauses(fromClause1, fromClause2);

            Assert.AreEqual("[Table1], [Table2]", sqlClientRenderer.Render(fromClauses));
        }
Example #6
0
        public void AddTableFromClauseToSelectQuery()
        {
            SelectQuery selectQuery = new SelectQuery();

            Table           table           = new Table("Table1");
            TableFromClause tableFromClause = new TableFromClause(table);

            selectQuery.From(tableFromClause);

            Assert.AreEqual(tableFromClause, selectQuery.FromClause);
        }
Example #7
0
        public void CreateFromClauses()
        {
            Table           table1      = new Table("Table1");
            Table           table2      = new Table("Table2");
            TableFromClause fromClause1 = new TableFromClause(table1);
            TableFromClause fromClause2 = new TableFromClause(table2);
            FromClauses     fromClauses = new FromClauses(fromClause1, fromClause2);

            Assert.AreEqual(fromClause1, fromClauses.LeftClause);
            Assert.AreEqual(fromClause2, fromClauses.RightClause);
        }
Example #8
0
        public override string Render(TableFromClause tableFromClause)
        {
            StringBuilder text = new StringBuilder();

            text.AppendFormat("{0} ", tableFromClause.Table.Render(this));

            if (tableFromClause.Alias != null)
            {
                text.AppendFormat("{0} ", tableFromClause.Alias);
            }

            return(text.ToString().Trim());
        }
Example #9
0
        public void AddFromClausesToSelectQuery()
        {
            SelectQuery selectQuery = new SelectQuery();

            Table           table1      = new Table("Table1");
            Table           table2      = new Table("Table2");
            TableFromClause fromClause1 = new TableFromClause(table1);
            TableFromClause fromClause2 = new TableFromClause(table2);

            selectQuery.From(fromClause1);
            selectQuery.From(fromClause2);

            Assert.IsTrue(selectQuery.FromClause is FromClauses);
        }
Example #10
0
 public abstract string Render(TableFromClause tableFromClause);
Example #11
0
 public static JoinFromClause Join(TableFromClause leftTable, TableFromClause rightTable, ComparisonPredicate predicate)
 {
     return new JoinFromClause(leftTable, rightTable, predicate);
 }