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

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

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

            QueryResult result = engine.Compile(func);

            Assert.Equal("COALESCE(`person`.`Name`, `person`.`SurName`)", result.Sql);
            Assert.Equal(new Dictionary <string, object>(), result.Parameters);
        }
예제 #3
0
        public void Coalesce_Object_Overload()
        {
            Person    person = null;
            IFunction func   = (IFunction)sql.Val(() => SqlExp.Coalesce(person.Name, person.Salary));

            QueryResult result = engine.Compile(func);

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