Exemplo n.º 1
0
        public async ValueTask AllAsync_With_ValidData_Must_Succeed(int[] source, Predicate <int> predicate)
        {
            // Arrange
            var wrapped  = Wrap.AsAsyncValueEnumerable(source);
            var expected =
                System.Linq.Enumerable.All(source, predicate.AsFunc());

            // Act
            var result = await AsyncValueEnumerable
                         .AllAsync <Wrap.AsyncValueEnumerable <int>, Wrap.AsyncEnumerator <int>, int>(wrapped, predicate.AsAsync());

            // Assert
            _ = result.Must()
                .BeEqualTo(expected);
        }
Exemplo n.º 2
0
        public void AllAsync_With_NullPredicate_Must_Throw()
        {
            // Arrange
            var wrapped   = Wrap.AsAsyncValueEnumerable(new int[0]);
            var predicate = (AsyncPredicate <int>)null;

            // Act
            Action action = () => _ = AsyncValueEnumerable
                                      .AllAsync <Wrap.AsyncValueEnumerable <int>, Wrap.AsyncEnumerator <int>, int>(wrapped, predicate);

            // Assert
            _ = action.Must()
                .Throw <ArgumentNullException>()
                .EvaluateTrue(exception => exception.ParamName == "predicate");
        }