コード例 #1
0
        public void RTrim_Character()
        {
            Person person = new Person();

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

            Assert.Equal("Only for expressions.", ex.Message);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #4
0
ファイル: SqlExpTest.cs プロジェクト: eksotama/Suilder
        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);
        }
コード例 #5
0
ファイル: SqlExpTest.cs プロジェクト: eksotama/Suilder
        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);
        }