public void ToString_WithJoinTable_NoJTSelectColumns() { var schema = "fromSchema"; var name = "fromTable"; var tableName = new EntityName(schema, name); var fromColumn1 = "fromCol1"; var fromColumn2 = "fromCol2"; var fromAlias2 = "fromAlias2"; var columns = new IColumnName[] { new ColumnName(fromColumn1), new ColumnName(fromColumn2, fromAlias2) }; IFromTable fromTable = new FromTable(tableName, columns); IEntityName joinTableName = new EntityName("joinTable"); var joinTable = new JoinTable(joinTableName); fromTable.Join(joinTable); var selectClause = fromTable.ToString(); var testString = $"select [{schema}].[{name}].[{fromColumn1}], [{schema}].[{name}].[{fromColumn2}] as [{fromAlias2}]\r\nfrom [{schema}].[{name}]\r\n"; Assert.AreEqual(testString.TrimEnd(), selectClause.TrimEnd()); }
public void ToString_WithSchema() { var schema = "fromSchema"; var name = "fromTable"; var tableName = new EntityName(schema, name); var fromColumn1 = "fromCol1"; var fromColumn2 = "fromCol2"; var fromAlias2 = "fromAlias2"; var columns = new IItemName[] { new ItemName(fromColumn1), new ColumnName(fromColumn2, fromAlias2) }; var ft = new FromTable(tableName, columns); Assert.AreEqual($"select [{schema}].[{name}].[{fromColumn1}], [{schema}].[{name}].[{fromColumn2}] as [{fromAlias2}]\r\nfrom [{schema}].[{name}]\r\n", ft.ToString()); }
public override string ToString() { return(FromTable.ToString() + " -> " + ToTable.ToString()); }