public void All_With_ValidData_Must_Succeed(int[] source, Predicate <int> predicate) { // Arrange var wrapped = Wrap.AsValueEnumerable(source); var expected = System.Linq.Enumerable.All(wrapped, predicate.AsFunc()); // Act var result = ValueEnumerableExtensions .All <Wrap.ValueEnumerableWrapper <int>, Wrap.Enumerator <int>, int>(wrapped, predicate); // Assert _ = result.Must() .BeEqualTo(expected); }
public void All_With_NullPredicate_Must_Throw() { // Arrange var wrapped = Wrap.AsValueEnumerable(new int[0]); var predicate = (Predicate <int>)null; // Act Action action = () => _ = ValueEnumerableExtensions .All <Wrap.ValueEnumerableWrapper <int>, Wrap.Enumerator <int>, int>(wrapped, predicate); // Assert _ = action.Must() .Throw <ArgumentNullException>() .EvaluateTrue(exception => exception.ParamName == "predicate"); }
public void All_PredicateAt_With_ValidData_Must_Succeed(int[] source, Func <int, int, bool> predicate) { // Arrange var wrapped = Wrap.AsValueEnumerable(source); var expected = System.Linq.Enumerable.Count( System.Linq.Enumerable.Where(source, predicate)) == source.Length; // Act var result = ValueEnumerableExtensions .All <Wrap.ValueEnumerableWrapper <int>, Wrap.Enumerator <int>, int>(wrapped, predicate); // Assert _ = result.Must() .BeEqualTo(expected); }