public void SimplyArraySearchTest() { var predicate = new PredicateGroup <int>(); predicate.Add(f => f == 1); predicate.Add(f => f == 3); predicate.Add(f => f == 5); var data = new[] { 1, 7, 6, 3, 8, 9, 4, 2 }; var result = data.AsQueryable().Where(predicate.Combine(Expression.OrElse)).ToArray(); Assert.IsTrue(result.Contains(1)); Assert.IsTrue(result.Contains(3)); Assert.IsFalse(result.Contains(2)); Assert.AreEqual(2, result.Length); }
public void SearchTextDocumentTest() { var predicate = new PredicateGroup <LuceneCache.TextDocument>(); predicate.Add(f => f.SearchText.StartsWith("keyword")); var data = new[] { new LuceneCache.TextDocument("", "", "", new ExtractionPointDetail()) { SearchText = "keyword" }, new LuceneCache.TextDocument("", "", "", new ExtractionPointDetail()) { SearchText = "non-keyword" } }; var result = data.AsQueryable().Where(predicate.Combine(Expression.OrElse)).ToArray(); Assert.AreEqual(1, result.Length); }