public void NotTest() { var parser = new IronyQueryConditionParser(); var expression = parser.Parse <Customer>("not Id eq 4"); var result = Customers.Where(expression.Compile()); Assert.Equal(14, result.Count()); }
public void AndTest() { var parser = new IronyQueryConditionParser(); var expression = parser.Parse <Customer>("Id ge 5 and Name eq \"jim\""); var result = Customers.Where(expression.Compile()); Assert.Single(result); }
public void StringContainsTest() { var parser = new IronyQueryConditionParser(); var expression = parser.Parse <Customer>("name ct \"ul\""); var result = Customers.Where(expression.Compile()); Assert.Equal(2, result.Count()); }
public void EqualTest() { var parser = new IronyQueryConditionParser(); var expression = parser.Parse <Customer>("Name eq \"paul\""); var result = Customers.Where(expression.Compile()); Assert.Single(result); }
public void StringStartsEndsWithCombinedTest() { var parser = new IronyQueryConditionParser(); var expression = parser.Parse <Customer>("name ew \"er\" and email sw \"w\""); var result = Customers.Where(expression.Compile()); Assert.Single(result); }
public void StringStartsWithTest() { var parser = new IronyQueryConditionParser(); var expression = parser.Parse <Customer>("email sw \"fr\""); var result = Customers.Where(expression.Compile()); Assert.Single(result); }
public void LessThanTest() { var parser = new IronyQueryConditionParser(); var expression = parser.Parse <Customer>("Id lt 5"); var result = Customers.Where(expression.Compile()); Assert.Equal(4, result.Count()); }
public void GreatThanOrEqualsToTest() { var parser = new IronyQueryConditionParser(); var expression = parser.Parse <Customer>("Id ge 5"); var result = Customers.Where(expression.Compile()); Assert.Equal(11, result.Count()); }
public void OrTest() { var parser = new IronyQueryConditionParser(); var expression = parser.Parse <Customer>("Id ge 5 or Name eq \"jim\""); var result = Customers.Where(expression.Compile()); Assert.Equal(12, result.Count()); }
public void DatePropertyGreatThanTest() { var today = DateTime.Now.ToString("MM/dd/yyyy"); var parser = new IronyQueryConditionParser(); var expression = parser.Parse <Customer>($"dateRegistered gt \"{today}\""); var result = Customers.Where(expression.Compile()); Assert.Equal(8, result.Count()); }
public void CombinedQueryTest() { var today = DateTime.Now.ToString("MM/dd/yyyy"); var parser = new IronyQueryConditionParser(); var queryString = $"(Name EQ \"jim\" or Name SW \"da\") AND NOT DateRegistered LT \"{today}\""; var expression = parser.Parse <Customer>(queryString); var result = Customers.Where(expression.Compile()); Assert.Equal(3, result.Count()); }