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

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

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

            QueryResult result = engine.Compile(func);

            Assert.Equal("ROUND(`person`.`Salary`)", result.Sql);
            Assert.Equal(new Dictionary <string, object>(), result.Parameters);
        }
Beispiel #3
0
        public void Round_Places()
        {
            Person    person = null;
            IFunction func   = (IFunction)sql.Val(() => SqlExp.Round(person.Salary, 2));

            QueryResult result = engine.Compile(func);

            Assert.Equal("ROUND(\"person\".\"Salary\", @p0)", result.Sql);
            Assert.Equal(new Dictionary <string, object>()
            {
                ["@p0"] = 2
            }, result.Parameters);
        }