public void AsAsyncValueEnumerable_With_ValueType_Must_ReturnCopy() { // Arrange var source = new int[0]; var wrapped = Wrap.AsAsyncValueEnumerable(source); // Act var result = AsyncValueEnumerableExtensions .AsAsyncValueEnumerable <Wrap.AsyncValueEnumerableWrapper <int>, Wrap.AsyncEnumerator <int>, int>(wrapped); // Assert _ = result.Must() .BeEqualTo(wrapped); }
public void AsAsyncValueEnumerable_With_ReferenceType_Must_ReturnSame() { // Arrange var source = new int[0]; var wrapped = Wrap .AsAsyncValueEnumerable(source) as IAsyncValueEnumerable <int, Wrap.AsyncEnumerator <int> >; // Act var result = AsyncValueEnumerableExtensions .AsAsyncValueEnumerable <IAsyncValueEnumerable <int, Wrap.AsyncEnumerator <int> >, Wrap.AsyncEnumerator <int>, int>(wrapped); // Assert _ = result.Must() .BeSameAs(wrapped); }
public void AsAsyncValueEnumerable6_Enumerator_With_ValidData_Must_Succeed(int[] source) { // Arrange var wrapped = Wrap .AsAsyncValueEnumerable(source); // Act var result = AsyncValueEnumerableExtensions .AsAsyncValueEnumerable <Wrap.AsyncValueEnumerableWrapper <int>, Wrap.AsyncEnumerator <int>, int>( wrapped, (enumerable, _) => enumerable.GetAsyncEnumerator()); // Assert _ = result.Must() .BeAsyncEnumerableOf <int>() .BeEqualTo(source); }
public async ValueTask AsAsyncValueEnumerable6_Sum_With_ValidData_Must_Succeed(int[] source) { // Arrange var wrapped = Wrap .AsAsyncValueEnumerable(source); var expected = source .Sum(); // Act var result = await AsyncValueEnumerableExtensions .AsAsyncValueEnumerable <Wrap.AsyncValueEnumerableWrapper <int>, Wrap.AsyncEnumerator <int>, AsyncValueEnumerator <int>, int>( wrapped, (enumerable, _) => enumerable.GetAsyncEnumerator(), (enumerable, cancellationToken) => new AsyncValueEnumerator <int>(((IAsyncEnumerable <int>)enumerable).GetAsyncEnumerator(cancellationToken))) .SumAsync() .ConfigureAwait(false); // Assert _ = result.Must() .BeEqualTo(expected); }