Пример #1
0
        public FatValueType Hyperlinq()
        {
            var sum = default(FatValueType);

            foreach (ref readonly var item in ListBindings.WhereRef(source, item => item.IsEven()))
            {
                sum += item;
            }
            return(sum);
        }
Пример #2
0
        public void WhereRef_PredicateAt_With_ValidData_Must_Succeed(int[] source, PredicateAt <int> predicate)
        {
            // Arrange
            var list     = source.ToList();
            var expected = Enumerable
                           .Where(source, predicate.AsFunc());

            // Act
            var result = ListBindings
                         .WhereRef(list, predicate);

            // Assert
#if NETCOREAPP3_1 || NET5_0
            //_ = result.Must()
            //    .BeEnumerableOf<int>()
            //    .BeEqualTo(expected, testRefStructs: false);
#else
            _ = result.Must()
                .BeEnumerableOf <int>()
                .BeEqualTo(expected, testRefStructs: false, testRefReturns: false);
#endif
            _ = result.SequenceEqual(expected).Must().BeTrue();
        }