Ejemplo n.º 1
0
    public void BlinqShouldEqualLinqNativeArrayGroupByThenSelectCount([ArrayValues] int[] sourceArr)
    {
        var source   = new NativeArray <int>(sourceArr, Allocator.Persistent);
        var expected = ExceptionAndValue(() =>
        {
            var groupBy = Linq.GroupBy(source, SelectSelf <int>().Invoke, (key, values) => key + Linq.Count(values));
            return(Linq.ToArray(groupBy));
        });
        var actual = ExceptionAndValue(() =>
        {
            var groupBy = Blinq.GroupBy(source, SelectSelf <int>(), SelectGrouping);
            return(Linq.ToArray(groupBy));
        });

        AssertAreEqual(expected, actual);
        source.Dispose();
    }
Ejemplo n.º 2
0
    public void BlinqShouldEqualLinqNativeArrayGroupByKey([ArrayValues] int[] sourceArr)
    {
        var source   = new NativeArray <int>(sourceArr, Allocator.Persistent);
        var expected = ExceptionAndValue(() =>
        {
            var groupBy = Linq.GroupBy(source, SelectSelf <int>().Invoke);
            return(Linq.ToArray(groupBy));
        });
        var actual = ExceptionAndValue(() =>
        {
            var groupBy = Linq.Cast <IGrouping <int, int> >(Blinq.GroupBy(source, SelectSelf <int>()));
            return(Linq.ToArray(groupBy));
        });

        AssertAreEqual(expected, actual);
        source.Dispose();
    }
Ejemplo n.º 3
0
    public void Execute()
    {
        var result = Blinq.GroupBy(Source, KeySelector, ResultSelector).ToNativeList(Allocator.Temp);

        result.Dispose();
    }