Ejemplo n.º 1
0
 public static void Union_SecondOrdered_SourceMultiple(ParallelQuery<int> leftQuery, int leftCount, ParallelQuery<int> rightQuery, int rightCount, int count)
 {
     IntegerRangeSet seenUnordered = new IntegerRangeSet(0, leftCount);
     int seen = leftCount;
     foreach (int i in leftQuery.Union(rightQuery.AsOrdered()))
     {
         if (i >= leftCount)
         {
             Assert.Equal(seen++, i);
         }
         else
         {
             seenUnordered.Add(i);
         }
     }
     Assert.Equal(count, seen);
     seenUnordered.AssertComplete();
 }
Ejemplo n.º 2
0
 public static void Union_Unordered_SourceMultiple(ParallelQuery<int> leftQuery, int leftCount, ParallelQuery<int> rightQuery, int rightCount, int count)
 {
     // The difference between this test and the previous, is that it's not possible to
     // get non-unique results from ParallelEnumerable.Range()...
     // Those tests either need modification of source (via .Select(x => x / DuplicateFactor) or similar,
     // or via a comparator that considers some elements equal.
     IntegerRangeSet seen = new IntegerRangeSet(0, count);
     Assert.All(leftQuery.Union(rightQuery), x => seen.Add(x));
     seen.AssertComplete();
 }