public static void SelectMany_ResultSelector(Labeled <ParallelQuery <int> > labeled, int count, Labeled <Func <int, int, IEnumerable <int> > > expander, int expansion)
        {
            ParallelQuery <int> query = labeled.Item;
            Func <int, int, IEnumerable <int> > expand = expander.Item;
            int seen = 0;

            foreach (var p in query.SelectMany(x => expand(x, expansion), (original, expanded) => KeyValuePair.Create(original, expanded)))
            {
                Assert.Equal(seen++, p.Value);
                Assert.Equal(p.Key, p.Value / expansion);
            }
            Assert.Equal(count * expansion, seen);
        }
        public static void SelectMany_ResultSelector_NotPipelined(Labeled <ParallelQuery <int> > labeled, int count, Labeled <Func <int, int, IEnumerable <int> > > expander, int expansion)
        {
            ParallelQuery <int> query = labeled.Item;
            Func <int, int, IEnumerable <int> > expand = expander.Item;
            int seen = 0;

            Assert.All(query.SelectMany(x => expand(x, expansion), (original, expanded) => KeyValuePair.Create(original, expanded)).ToList(),
                       p =>
            {
                Assert.Equal(seen++, p.Value);
                Assert.Equal(p.Key, p.Value / expansion);
            });
            Assert.Equal(count * expansion, seen);
        }
        public static void SelectMany_Unordered_ResultSelector_NotPipelined(int count, Labeled <Func <int, int, IEnumerable <int> > > expander, int expansion)
        {
            Func <int, int, IEnumerable <int> > expand = expander.Item;
            IntegerRangeSet seen = new IntegerRangeSet(0, count * expansion);

            Assert.All(UnorderedSources.Default(count).SelectMany(x => expand(x, expansion), (original, expanded) => KeyValuePair.Create(original, expanded)).ToList(),
                       p =>
            {
                seen.Add(p.Value);
                Assert.Equal(p.Key, p.Value / expansion);
            });
            seen.AssertComplete();
        }