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

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

            Assert.Equal("Only for expressions.", ex.Message);
        }
コード例 #2
0
        public void Concat()
        {
            Person    person = null;
            IFunction func   = (IFunction)sql.Val(() => SqlExp.Concat(person.Name, person.SurName));

            QueryResult result = engine.Compile(func);

            Assert.Equal("CONCAT(`person`.`Name`, `person`.`SurName`)", result.Sql);
            Assert.Equal(new Dictionary <string, object>(), result.Parameters);
        }
コード例 #3
0
        public void ConcatOr_Invalid()
        {
            engine.AddFunction(FunctionName.Concat, FunctionHelper.ConcatOr);

            IFunction func = (IFunction)sql.Val(() => SqlExp.Concat());

            Exception ex = Assert.Throws <CompileException>(() => engine.Compile(func));

            Assert.Equal("Invalid function \"CONCAT\", wrong number of parameters.", ex.Message);
        }
コード例 #4
0
        public void Concat()
        {
            Person    person = null;
            IFunction func   = (IFunction)sql.Val(() => SqlExp.Concat(person.Name, person.SurName));

            QueryResult result = engine.Compile(func);

            Assert.Equal("\"PERSON\".\"NAME\" || \"PERSON\".\"SURNAME\"", result.Sql);
            Assert.Equal(new Dictionary <string, object>(), result.Parameters);
        }
コード例 #5
0
ファイル: SqlExpTest.cs プロジェクト: eksotama/Suilder
        public void Concat_With_Or()
        {
            engine.AddFunction(FunctionName.Concat, FunctionHelper.ConcatOr);

            Person    person = null;
            IFunction func   = (IFunction)sql.Val(() => SqlExp.Concat(person.Name, person.SurName));

            QueryResult result = engine.Compile(func);

            Assert.Equal("\"person\".\"Name\" || \"person\".\"SurName\"", result.Sql);
            Assert.Equal(new Dictionary <string, object>(), result.Parameters);
        }