Ejemplo n.º 1
0
        public void Indexer_With_IndexOutOfRange_Must_Throw(int value, int index)
        {
            // Arrange

            // Act
            Func <int> action = () => ValueEnumerable.Return(value)[index];

            // Assert
            _ = action.Must().Throw <ArgumentOutOfRangeException>();
        }
Ejemplo n.º 2
0
        public int Hyperlinq_Return()
        {
            var sum = 0;

            foreach (var item in ValueEnumerable.Return(1))
            {
                sum += item;
            }
            return(sum);
        }
        public int Hyperlinq_Collection_Value()
        {
            var sum = 0;

            foreach (var item in collectionValue.AsValueEnumerable()
                     .SelectMany(item => ValueEnumerable.Return(item)))
            {
                sum += item;
            }
            return(sum);
        }
Ejemplo n.º 4
0
        public int Hyperlinq_Collection_Value()
        {
            var sum = 0;

            foreach (var item in EnumerableExtensions.AsValueEnumerable <TestCollection.Enumerable, TestCollection.Enumerable.Enumerator, int>(collectionValue, enumerable => enumerable.GetEnumerator())
                     .SelectMany(item => ValueEnumerable.Return(item)))
            {
                sum += item;
            }
            return(sum);
        }
        public int Hyperlinq_List_Reference()
        {
            var sum = 0;

            foreach (var item in listReference
                     .AsValueEnumerable()
                     .SelectMany(item => ValueEnumerable.Return(item)))
            {
                sum += item;
            }
            return(sum);
        }
Ejemplo n.º 6
0
        public void Return_With_Value_Must_Succeed(int value)
        {
            // Arrange
            var expected = System.Linq.EnumerableEx.Return(value);

            // Act
            var result = ValueEnumerable.Return(value);

            // Assert
            _ = result.Must()
                .BeEnumerableOf <int>()
                .BeEqualTo(expected);
        }
Ejemplo n.º 7
0
        public int Hyperlinq_List_Reference()
        {
            var sum = 0;

            foreach (var item in listReference
                     .AsValueEnumerable()
                     .SelectMany <
                         ReadOnlyListExtensions.ValueEnumerableWrapper <int>, int,
                         ValueEnumerable.ReturnEnumerable <int>, ValueEnumerable.ReturnEnumerable <int> .DisposableEnumerator, int>(
                         item => ValueEnumerable.Return(item)))
            {
                sum += item;
            }
            return(sum);
        }
        public int Hyperlinq_Collection_Reference()
        {
            var sum = 0;

            foreach (var item in collectionReference.AsValueEnumerable()
                     .SelectMany <
                         ReadOnlyCollection.ValueEnumerableWrapper <int>, ReadOnlyCollection.ValueEnumerableWrapper <int> .Enumerator, int,
                         ValueEnumerable.ReturnEnumerable <int>, ValueEnumerable.ReturnEnumerable <int> .DisposableEnumerator, int>(item => ValueEnumerable.Return(item)))
            {
                sum += item;
            }
            return(sum);
        }
        public int Hyperlinq_Enumerable_Reference()
        {
            var sum = 0;

            foreach (var item in enumerableReference.AsValueEnumerable()
                     .SelectMany <
                         Enumerable.ValueEnumerableWrapper <int>, Enumerable.ValueEnumerableWrapper <int> .Enumerator, int,
                         ValueEnumerable.ReturnEnumerable <int>, ValueEnumerable.ReturnEnumerable <int> .DisposableEnumerator, int>(item => ValueEnumerable.Return(item)))
            {
                sum += item;
            }
            return(sum);
        }
        public int Hyperlinq_List_Value()
        {
            var sum = 0;

            foreach (var item in Enumerable.AsValueEnumerable <TestList.Enumerable, TestList.Enumerable.Enumerator, int>(listValue, enumerable => enumerable.GetEnumerator())
                     .SelectMany <
                         Enumerable.ValueEnumerableWrapper <TestList.Enumerable, TestList.Enumerable.Enumerator, int>, TestList.Enumerable.Enumerator, int,
                         ValueEnumerable.ReturnEnumerable <int>, ValueEnumerable.ReturnEnumerable <int> .DisposableEnumerator, int>(item => ValueEnumerable.Return(item)))
            {
                sum += item;
            }
            return(sum);
        }
        public int Hyperlinq_Memory()
        {
            var sum = 0;

            foreach (var item in memory.SelectMany <int, ValueEnumerable.ReturnEnumerable <int>, ValueEnumerable.ReturnEnumerable <int> .DisposableEnumerator, int>(item => ValueEnumerable.Return(item)))
            {
                sum += item;
            }
            return(sum);
        }
Ejemplo n.º 12
0
        public int Hyperlinq_Array()
        {
            var sum = 0;

            foreach (var item in array.AsValueEnumerable().SelectMany <ValueEnumerable.ReturnEnumerable <int>, ValueEnumerable.ReturnEnumerable <int> .DisposableEnumerator, int>(item => ValueEnumerable.Return(item)))
            {
                sum += item;
            }
            return(sum);
        }
        public int Hyperlinq_List_Reference()
        {
            var count = 0;

            foreach (var item in ReadOnlyList.SelectMany <
                         ReadOnlyList.ValueEnumerableWrapper <int>, int,
                         ValueEnumerable.ReturnEnumerable <int>, ValueEnumerable.ReturnEnumerable <int> .DisposableEnumerator, int>(
                         ReadOnlyList.AsValueEnumerable <int>(listReference), item => ValueEnumerable.Return(item)))
            {
                count++;
            }
            return(count);
        }
        public int Hyperlinq_Collection_Value()
        {
            var count = 0;

            foreach (var item in Enumerable.AsValueEnumerable <TestCollection.Enumerable, TestCollection.Enumerable.Enumerator, int>(collectionValue, enumerable => enumerable.GetEnumerator())
                     .SelectMany <
                         Enumerable.ValueEnumerableWrapper <TestCollection.Enumerable, TestCollection.Enumerable.Enumerator, int>, TestCollection.Enumerable.Enumerator, int,
                         ValueEnumerable.ReturnEnumerable <int>, ValueEnumerable.ReturnEnumerable <int> .DisposableEnumerator, int>(item => ValueEnumerable.Return(item)))
            {
                count++;
            }
            return(count);
        }
        public int Hyperlinq_Memory()
        {
            var count = 0;

            foreach (var item in memory.SelectMany <int, ValueEnumerable.ReturnEnumerable <int>, ValueEnumerable.ReturnEnumerable <int> .DisposableEnumerator, int>(item => ValueEnumerable.Return(item)))
            {
                count++;
            }
            return(count);
        }