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