Example #1
0
        public void NullTest()
        {
            WhereParams <InvoiceIssueDomain> param = null;

            var build = new WhereBuilder <InvoiceIssue, InvoiceIssueDomain>(_dc.InvoiceIssue, param);

            build.WhereBind(x => x.InvoicePrefix, y => y.InvoicePrefix);

            var query = build.Build();
            var sql   = query.ToString();

            Assert.NotEmpty(sql);
        }
Example #2
0
        public void StringValueTest(WhereOperator oper, string expected)
        {
            var param = new WhereParams <InvoiceIssueDomain>();

            param.SetValues(x => x.InvoicePrefix, oper, "SS");

            var build = new WhereBuilder <InvoiceIssue, InvoiceIssueDomain>(_dc.InvoiceIssue, param);

            build.WhereBind(x => x.InvoicePrefix, y => y.InvoicePrefix);

            var query = build.Build();
            var sql   = query.ToString();

            Assert.Contains(expected, sql);
        }
Example #3
0
        public void SubQueryTest(WhereOperator oper, string expected)
        {
            var param = new WhereParams <InvoiceIssueDomain>();

            param.SetValues(x => x.ProductQty, oper, 1, 3);

            var build = new WhereBuilder <InvoiceIssue, InvoiceIssueDomain>(_dc.InvoiceIssue, param);

            build.WhereBind <int?>(x => x.ProductQty, y => y.InvoiceIssueItems.Select(z => (int?)z.Qty));

            var query = build.Build();
            var sql   = query.ToString();

            Assert.Contains(expected, sql);
        }
Example #4
0
        public void DecimalValueTest(WhereOperator oper, string expected)
        {
            var param = new WhereParams <InvoiceIssueDomain>();

            param.SetValues(x => x.Sum, oper, 1.0m, 3.0m);

            var build = new WhereBuilder <InvoiceIssue, InvoiceIssueDomain>(_dc.InvoiceIssue, param);

            build.WhereBind(x => x.Sum, y => y.Total);

            var query = build.Build();
            var sql   = query.ToString();

            Assert.Contains(expected, sql);
        }
Example #5
0
        public void DateTimeValueTest(WhereOperator oper, string expected)
        {
            var param = new WhereParams <InvoiceIssueDomain>();

            param.SetValues(x => x.ModifyDate, oper, DateTime.Today, DateTime.Now);

            var build = new WhereBuilder <InvoiceIssue, InvoiceIssueDomain>(_dc.InvoiceIssue, param);

            build.WhereBind(x => x.ModifyDate, y => y.ModifyDate);

            var query = build.Build();
            var sql   = query.ToString();

            Assert.Contains(expected, sql);
        }