示例#1
0
        public void Expression_Method_ForeignKey(object value)
        {
            Person    person = null;
            IOperator op     = sql.Op(() => SqlExp.NotEq(person.Department.Id, value));

            QueryResult result = engine.Compile(op);

            Assert.Equal("\"person\".\"DepartmentId\" <> @p0", result.Sql);
            Assert.Equal(new Dictionary <string, object>
            {
                ["@p0"] = value
            }, result.Parameters);
        }
示例#2
0
        public void Expression_Method_Nested(object value)
        {
            Person    person = null;
            IOperator op     = sql.Op(() => SqlExp.NotEq(person.Address.Street, value));

            QueryResult result = engine.Compile(op);

            Assert.Equal("\"person\".\"AddressStreet\" <> @p0", result.Sql);
            Assert.Equal(new Dictionary <string, object>
            {
                ["@p0"] = value
            }, result.Parameters);
        }
示例#3
0
        public void Expression_Method_Inline_Value()
        {
            Person    person = null;
            IOperator op     = sql.Op(() => SqlExp.NotEq(person.Id, 1));

            QueryResult result = engine.Compile(op);

            Assert.Equal("\"person\".\"Id\" <> @p0", result.Sql);
            Assert.Equal(new Dictionary <string, object>
            {
                ["@p0"] = 1
            }, result.Parameters);
        }
示例#4
0
        public void Expression_Method_List_Inline_Value()
        {
            Department dept = null;
            IOperator  op   = sql.Op(() => SqlExp.NotEq(dept.Tags, new List <string> {
                "abcd", "efgh", "ijkl"
            }));

            QueryResult result = engine.Compile(op);

            Assert.Equal("\"dept\".\"Tags\" <> @p0", result.Sql);
            Assert.Equal(new Dictionary <string, object>
            {
                ["@p0"] = new List <string> {
                    "abcd", "efgh", "ijkl"
                }
            }, result.Parameters);
        }