예제 #1
0
            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);
            }
예제 #2
0
            public void ProduceValidSqlQuery_With_SelectAllColumnsFromATableWithoutAlias()
            {
                ICanCallAfterSqlBuilder builder = Dsl.PlainSql();

                string result = builder.SelectAllColumns().From(TableName).WithoutAlias().ToSql();

                Assert.Equal($"SELECT * {DefaultFromWithoutAlias}", result);
            }
예제 #3
0
            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);
            }
예제 #4
0
            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);
            }
예제 #5
0
            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);
            }