Example #1
0
        public void Expression_Method_Invalid_Call()
        {
            Person person = new Person();

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

            Assert.Equal("Only for expressions.", ex.Message);
        }
Example #2
0
        public void Expression_Method_Nested_Deep()
        {
            Person2   person = null;
            IOperator op     = sql.Op(() => SqlExp.IsNull(person.Address.City.Country.Name));

            QueryResult result = engine.Compile(op);

            Assert.Equal("\"person\".\"AddressCityCountryName\" IS NULL", result.Sql);
            Assert.Equal(new Dictionary <string, object>(), result.Parameters);
        }
Example #3
0
        public void Expression_Method_ForeignKey()
        {
            Person    person = null;
            IOperator op     = sql.Op(() => SqlExp.IsNull(person.Department.Id));

            QueryResult result = engine.Compile(op);

            Assert.Equal("\"person\".\"DepartmentId\" IS NULL", result.Sql);
            Assert.Equal(new Dictionary <string, object>(), result.Parameters);
        }