Example #1
0
        public void AsValueEnumerable_With_ValueType_Must_ReturnCopy()
        {
            // Arrange
            var source  = new int[0];
            var wrapped = Wrap.AsValueEnumerable(source);

            // Act
            var result = ValueEnumerableExtensions
                         .AsValueEnumerable <Wrap.ValueEnumerableWrapper <int>, Wrap.Enumerator <int>, int>(wrapped);

            // Assert
            _ = result.Must()
                .BeEqualTo(wrapped);
        }
Example #2
0
        public void AsValueEnumerable_With_ReferenceType_Must_ReturnSame()
        {
            // Arrange
            var source  = new int[0];
            var wrapped = Wrap
                          .AsValueEnumerable(source) as IValueEnumerable <int, Wrap.Enumerator <int> >;

            // Act
            var result = ValueEnumerableExtensions
                         .AsValueEnumerable <IValueEnumerable <int, Wrap.Enumerator <int> >, Wrap.Enumerator <int>, int>(wrapped);

            // Assert
            _ = result.Must()
                .BeSameAs(wrapped);
        }
Example #3
0
        public void AsValueEnumerable6_Enumerator2_With_ValidData_Must_Succeed(int[] source)
        {
            // Arrange
            var wrapped = Wrap
                          .AsValueReadOnlyList(source);

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

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

            // Act
            var result = ValueEnumerableExtensions
                         .AsValueEnumerable <Wrap.ValueReadOnlyCollectionWrapper <int>, Wrap.Enumerator <int>, int>(
                wrapped,
                enumerable => enumerable.GetEnumerator())
                         .Sum();

            // Assert
            _ = result.Must()
                .BeEqualTo(expected);
        }