コード例 #1
0
        protected void Initialize(int[] array)
        {
            this.array = array;
            memory     = array.AsMemory();

            enumerableReference      = enumerableValue = Wrap.AsEnumerable(array);
            collectionReference      = collectionValue = Wrap.AsCollection(array);
            listReference            = listValue = Wrap.AsList(array);
            asyncEnumerableReference = asyncEnumerableValue = Wrap.AsAsyncEnumerable(array);
        }
コード例 #2
0
        public void AsValueEnumerable1_With_ValidData_Must_Succeed(int[] source)
        {
            // Arrange
            var wrapped = Wrap
                          .AsEnumerable(source);

            // Act
            var result = wrapped
                         .AsValueEnumerable();

            // Assert
            _ = result.Must()
                .BeEnumerableOf <int>()
                .BeEqualTo(source);
        }
        public void AsValueEnumerable_GetEnumerator_With_ValidData_Must_Succeed(int[] source)
        {
            // Arrange
            var wrapped = Wrap
                          .AsEnumerable(source);

            // Act
            var result = EnumerableExtensions
                         .AsValueEnumerable <Wrap.EnumerableWrapper <int>, Wrap.Enumerator <int>, int>(wrapped, enumerable => enumerable.GetEnumerator());

            // Assert
            _ = result.Must()
                .BeEnumerableOf <int>()
                .BeEqualTo(wrapped);
        }
コード例 #4
0
        public void AsValueEnumerable1_Sum_With_ValidData_Must_Succeed(int[] source)
        {
            // Arrange
            var wrapped = Wrap
                          .AsEnumerable(source);
            var expected = source
                           .Sum();

            // Act
            var result = wrapped
                         .AsValueEnumerable()
                         .Sum();

            // Assert
            _ = result.Must()
                .BeEqualTo(expected);
        }
        public void AsValueEnumerable6_Enumerator2_With_ValidData_Must_Succeed(int[] source)
        {
            // Arrange
            var wrapped = Wrap
                          .AsEnumerable(source);

            // Act
            var result = wrapped
                         .AsValueEnumerable <Wrap.EnumerableWrapper <int>, Wrap.Enumerator <int>, ValueEnumerator <int>, int>(
                enumerable => enumerable.GetEnumerator(),
                enumerable => new ValueEnumerator <int>(((IEnumerable <int>)enumerable).GetEnumerator()));

            // Assert
            _ = result.Must()
                .BeEnumerableOf <int>()
                .BeEqualTo(source);
        }
        public void AsValueEnumerable_With_ToArray_Must_Succeed(int[] source)
        {
            // Arrange
            var wrapped = Wrap
                          .AsEnumerable(source);
            var expected = Enumerable
                           .ToArray(source);

            // Act
            var result = EnumerableExtensions
                         .AsValueEnumerable <int>(wrapped)
                         .ToArray();

            // Assert
            _ = result.Must()
                .BeArrayOf <int>()
                .BeEqualTo(expected);
        }
コード例 #7
0
        public void ToArray_With_ValidData_Must_Succeed(int[] source)
        {
            // Arrange
            var wrapped = Wrap
                          .AsEnumerable(source);
            var expected =
                System.Linq.Enumerable.ToArray(source);

            // Act
            var result = Enumerable
                         .AsValueEnumerable <int>(wrapped)
                         .ToArray();

            // Assert
            _ = result.Must()
                .BeArrayOf <int>()
                .BeEqualTo(expected);
        }
        public void AsValueEnumerable_GetEnumerator_With_ToList_Must_Succeed(int[] source)
        {
            // Arrange
            var wrapped = Wrap
                          .AsEnumerable(source);
            var expected = Enumerable
                           .ToList(source);

            // Act
            var result = EnumerableExtensions
                         .AsValueEnumerable <Wrap.EnumerableWrapper <int>, Wrap.Enumerator <int>, int>(wrapped, enumerable => enumerable.GetEnumerator())
                         .ToList();

            // Assert
            _ = result.Must()
                .BeOfType <List <int> >()
                .BeEnumerableOf <int>()
                .BeEqualTo(expected);
        }
コード例 #9
0
        public void ToList_With_ValidData_Must_Succeed(int[] source)
        {
            // Arrange
            var wrapped = Wrap
                          .AsEnumerable(source);
            var expected = Enumerable
                           .ToList(source);

            // Act
            var result = EnumerableExtensions
                         .AsValueEnumerable <int>(wrapped)
                         .ToList();

            // Assert
            _ = result.Must()
                .BeOfType <List <int> >()
                .BeEnumerableOf <int>()
                .BeEqualTo(expected);
        }