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

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

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

            QueryResult result = engine.Compile(func);

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

            QueryResult result = engine.Compile(func);

            Assert.Equal("RTRIM(\"PERSON\".\"NAME\")", result.Sql);
            Assert.Equal(new Dictionary <string, object>(), result.Parameters);
        }
Beispiel #4
0
        public void RTrim_Trim_Leading()
        {
            engine.AddFunction(FunctionName.RTrim, FunctionHelper.TrimTrailing);

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

            QueryResult result = engine.Compile(func);

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

            QueryResult result = engine.Compile(func);

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