Пример #1
0
    public void BlinqShouldEqualLinqNativeArraySingleOrDefaultPredicate([ArrayValues] int[] sourceArr)
    {
        var source   = new NativeArray <int>(sourceArr, Allocator.Persistent);
        var expected = ExceptionAndValue(() => Linq.SingleOrDefault(source, EqualsZero.Invoke));
        var actual   = ExceptionAndValue(() => source.SingleOrDefault(EqualsZero));

        AssertAreEqual(expected, actual);
        source.Dispose();
    }
Пример #2
0
    public void BlinqShouldEqualLinqNativeSequenceSingleOrDefault([ArrayValues] int[] sourceArr)
    {
        var sourceNativeArr = new NativeArray <int>(sourceArr, Allocator.Persistent);
        var source          = sourceNativeArr.ToValueSequence();
        var expected        = ExceptionAndValue(() => Linq.SingleOrDefault(source));
        var actual          = ExceptionAndValue(() => source.SingleOrDefault());

        AssertAreEqual(expected, actual);
        sourceNativeArr.Dispose();
    }
Пример #3
0
 public static TSource SingleOrDefault <TSource>(this IEnumerable <TSource> source, Func <TSource, bool> predicate) =>
 LinqEnumerable.SingleOrDefault(source, predicate);
Пример #4
0
 public static TSource SingleOrDefault <TSource>(this IEnumerable <TSource> source) =>
 LinqEnumerable.SingleOrDefault(source);