public void AndOrMix() { var item1 = new Filter { Field = "Id", Operation = OperationType.Equal, Value = 1, OrGroup = "a" }; var item2 = new Filter { Field = "Id", Operation = OperationType.Equal, Value = 2, OrGroup = "a" }; var item3 = new Filter { Field = "Id", Operation = OperationType.Equal, Value = 3 }; var sm = new QueryModel(); sm.AddRange(new[] { item1, item2, item3 }); IQueryable <MyClass> query = _table.AsQueryable(); IQueryable <MyClass> actual = query.Where(sm); Assert.AreEqual(0, actual.Count()); }
public void TwoGroup() { var item1 = new Filter { Field = "Id", Operation = OperationType.Equal, Value = 1, OrGroup = "a" }; var item2 = new Filter { Field = "Id", Operation = OperationType.Equal, Value = 2, OrGroup = "a" }; var item3 = new Filter { Field = "Id", Operation = OperationType.Equal, Value = 2, OrGroup = "b" }; var item4 = new Filter { Field = "Id", Operation = OperationType.Equal, Value = 3, OrGroup = "b" }; var sm = new QueryModel(); sm.AddRange(new[] { item1, item2, item3, item4 }); IQueryable<MyClass> query = _table.AsQueryable(); IQueryable<MyClass> actual = query.Where(sm); Assert.AreEqual(1, actual.Count()); }