public void LTrim_Character()
        {
            Person person = new Person();

            Exception ex = Assert.Throws <InvalidOperationException>(() => SqlExp.LTrim(person.Name, ","));

            Assert.Equal("Only for expressions.", ex.Message);
        }
Exemple #2
0
        public void LTrim()
        {
            Person    person = null;
            IFunction func   = (IFunction)sql.Val(() => SqlExp.LTrim(person.Name));

            QueryResult result = engine.Compile(func);

            Assert.Equal("TRIM(LEADING FROM `person`.`Name`)", result.Sql);
            Assert.Equal(new Dictionary <string, object>(), result.Parameters);
        }
Exemple #3
0
        public void LTrim()
        {
            Person    person = null;
            IFunction func   = (IFunction)sql.Val(() => SqlExp.LTrim(person.Name));

            QueryResult result = engine.Compile(func);

            Assert.Equal("LTRIM(\"PERSON\".\"NAME\")", result.Sql);
            Assert.Equal(new Dictionary <string, object>(), result.Parameters);
        }
Exemple #4
0
        public void LTrim_Trim_Leading()
        {
            engine.AddFunction(FunctionName.LTrim, FunctionHelper.TrimLeading);

            Person    person = null;
            IFunction func   = (IFunction)sql.Val(() => SqlExp.LTrim(person.Name));

            QueryResult result = engine.Compile(func);

            Assert.Equal("TRIM(LEADING FROM \"person\".\"Name\")", result.Sql);
            Assert.Equal(new Dictionary <string, object>(), result.Parameters);
        }
Exemple #5
0
        public void LTrim_Character()
        {
            Person    person = null;
            IFunction func   = (IFunction)sql.Val(() => SqlExp.LTrim(person.Name, ","));

            QueryResult result = engine.Compile(func);

            Assert.Equal("LTRIM(\"person\".\"Name\", @p0)", result.Sql);
            Assert.Equal(new Dictionary <string, object>()
            {
                ["@p0"] = ","
            }, result.Parameters);
        }