public void ToString_SingleTable () { var dataInfo = new TestStreamedValueInfo (typeof (int)); var selectProjection = Expression.Constant (1); var sqlTable = new SqlTable (new ResolvedSimpleTableInfo (typeof (Cook), "CookTable", "c"), JoinSemantics.Inner); var sqlStatement = new SqlStatement ( dataInfo, selectProjection, new[] { sqlTable }, null, null, new Ordering[0], null, false, null, null); var result = sqlStatement.ToString (); Assert.That (result, Is.EqualTo ("SELECT 1 FROM [CookTable] [c]")); }
public void ToString_MandatoryProperties () { var dataInfo = new TestStreamedValueInfo (typeof (int)); var selectProjection = Expression.Constant (1); var sqlStatement = new SqlStatement (dataInfo, selectProjection, new SqlTable[0], null, null, new Ordering[0], null, false, null, null); var result = sqlStatement.ToString(); Assert.That (result, Is.EqualTo ("SELECT 1")); }
public void ToString_AllProperties () { var dataInfo = new TestStreamedValueInfo (typeof (int)); var selectProjection = Expression.Constant (1); var sqlTable1 = new SqlTable (new ResolvedSimpleTableInfo (typeof (Cook), "CookTable", "c"), JoinSemantics.Inner); var sqlTable2 = new SqlTable (new ResolvedSimpleTableInfo (typeof (Kitchen), "KitchenTable", "k"), JoinSemantics.Left); var ordering = new Ordering (Expression.Constant ("ordering"), OrderingDirection.Asc); var whereCondition = Expression.Constant (true); var topExpression = Expression.Constant (10); var groupExpression = Expression.Constant ("group"); var sqlStatement = new SqlStatement ( dataInfo, selectProjection, new[] { sqlTable1, sqlTable2 }, whereCondition, groupExpression, new[] { ordering }, topExpression, true, null, null); var result = sqlStatement.ToString(); Assert.That ( result, Is.EqualTo ( "SELECT DISTINCT TOP (10) 1 FROM [CookTable] [c], [KitchenTable] [k] WHERE True GROUP BY \"group\" ORDER BY \"ordering\" ASC")); }