public void ProduceValidSqlQuery_WithWhereClause_AlphanumericEqual(string inputColumn, string inputValue, string expected) { ICanCallAfterSqlBuilder builder = Dsl.PlainSql(); string result = builder.SelectAllColumns().From(TableName).Where(inputColumn).IsEqualTo(inputValue).ToSql(); Assert.Equal($"{DefaulSelectFromWithWhere} {expected}", result); }
public void ProduceValidSqlQuery_With_SelectAllColumnsFromATableWithoutAlias() { ICanCallAfterSqlBuilder builder = Dsl.PlainSql(); string result = builder.SelectAllColumns().From(TableName).WithoutAlias().ToSql(); Assert.Equal($"SELECT * {DefaultFromWithoutAlias}", result); }
public void ProduceValidSqlQuery_With_AndIsEqualClause(string whereColumn, string whereValue, string andColumn, string andValue, string expected) { ICanCallAfterSqlBuilder builder = Dsl.PlainSql(); string result = builder.SelectAllColumns().From(TableName).Where(whereColumn).IsEqualTo(whereValue).And(andColumn).IsEqualTo(andValue).ToSql(); Assert.Equal($"{DefaulSelectFromWithWhere} {expected}", result); }
public void ProduceValidSqlQuery_With_SelectSpecificColumnUsingFromWithoutAlias(IEnumerable <string> inputColumns, string inputTable, string expected) { ICanCallAfterSqlBuilder builder = Dsl.PlainSql(); ICanCallAfterSelectColumn afterSelectColumn = null; foreach (string column in inputColumns) { afterSelectColumn = builder.SelectColumn(column); } string result = afterSelectColumn.From(inputTable).WithoutAlias().ToSql(); Assert.Equal($"{expected}", result); }
public void ProduceValidSqlQuery_With_SelectSpecificColumnUsingDefaultFrom(IEnumerable <string> inputColumns, string tableName, string expected) { ICanCallAfterSqlBuilder builder = Dsl.PlainSql(); ICanCallAfterSelectColumn afterSelectColumn = null; foreach (string column in inputColumns) { afterSelectColumn = builder.SelectColumn(column); } string result = afterSelectColumn.From(tableName).ToSql(); Assert.Equal(expected, result); }