public void ListUniqueAggregator() { var lstUnq = new ListUniqueAggregator("f"); Func <object, string, object> getVal = (r, f) => { return(r); }; for (int i = 10; i >= 0; i--) { lstUnq.Push(i % 5, getVal); } Assert.Equal("0,1,2,3,4", String.Join(",", ((IEnumerable)lstUnq.Value).Cast <object>().Select(v => v.ToString()).ToArray())); Assert.Equal(11, (int)lstUnq.Count); }
public void ListUniqueAggregator_Merge() { var lstUnqAggr1 = new ListUniqueAggregator("test"); var lstUnqAggr2 = new ListUniqueAggregator("test"); Func <object, string, object> getVal = (r, f) => { return(r); }; for (int i = 10; i >= 0; i--) { lstUnqAggr1.Push(i % 5, getVal); lstUnqAggr2.Push(i % 2 == 0 ? null : (object)i, getVal); } lstUnqAggr2.Merge(lstUnqAggr1); Assert.Equal("0,1,2,3,4,5,7,9", String.Join(",", ((IEnumerable)lstUnqAggr2.Value).Cast <object>().Select(v => v.ToString()).ToArray())); }