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

            Exception ex = Assert.Throws <InvalidOperationException>(() => SqlExp.Length(person.Name));

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

            QueryResult result = engine.Compile(func);

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