public void ContainsWithGivenExpressionTest() { var list = new List <int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; var val0 = Colls.Contains(list, v => v > 9); var val1 = Colls.Contains(list, v => v > 10); var val2 = Colls.Contains(list, v => v > 11); val0.ShouldBeTrue(); val1.ShouldBeFalse(); val2.ShouldBeFalse(); }
public static bool Contains <T>(this IEnumerable <T> source, Expression <Func <T, bool> > condition) { return(Colls.Contains(source, condition)); }