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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }