コード例 #1
0
        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
ファイル: SqlExpTest.cs プロジェクト: Ropticus/Suilder
        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);
        }