コード例 #1
0
        public void Expression_Method_Invalid_Call()
        {
            Person person = new Person();

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

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

            QueryResult result = engine.Compile(op);

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

            QueryResult result = engine.Compile(op);

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