public void Creates_a_grouping()
        {
            var factory = new HarshGroupingDynamicFactory(typeof(Int32), typeof(String));
            var grouping = factory.Create(42, new[] { "a", "b", "c" });

            var typed = Assert.IsType<HarshGrouping<Int32, String>>(grouping);
            Assert.Equal(42, typed.Key);
            Assert.Equal("a b c".Split(' '), typed);
        }
예제 #2
0
        public void Creates_a_grouping()
        {
            var factory  = new HarshGroupingDynamicFactory(typeof(Int32), typeof(String));
            var grouping = factory.Create(42, new[] { "a", "b", "c" });

            var typed = Assert.IsType <HarshGrouping <Int32, String> >(grouping);

            Assert.Equal(42, typed.Key);
            Assert.Equal("a b c".Split(' '), typed);
        }
 public override IEnumerable <Object> ConvertResults(IEnumerable <Object> results)
 => base.ConvertResults(results)
 .Cast <Tuple <Object, ImmutableArray <Object> > >()
 .GroupBy(
     tuple => tuple.Item1,
     tuple => tuple.Item2,
     (key, elements) => _groupingFactory.Create(
         key,
         ConvertElements(elements).ToImmutableArray()
         )
     )
 .ToImmutableArray();