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); }
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); }
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); }
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); }
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); }