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

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

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