|
5 | 5 | using System.Collections.Concurrent;
|
6 | 6 | using System.Collections.Generic;
|
7 | 7 | using System.Linq;
|
| 8 | +using System.Threading; |
8 | 9 | using Xunit;
|
9 | 10 |
|
10 | 11 | namespace Test
|
@@ -131,22 +132,26 @@ public static void Merge_Ordered_Longrunning(Labeled<ParallelQuery<int>> labeled
|
131 | 132 | }
|
132 | 133 |
|
133 | 134 | [Theory]
|
134 |
| - [MemberData("MergeData", (object)(new int[] { 16, 1024 }))] |
135 |
| - [MemberData("ThrowOnCount_AllMergeOptions_MemberData", (object)(new int[] { 16, 1024 }))] |
| 135 | + [MemberData("ThrowOnCount_AllMergeOptions_MemberData", (object)(new int[] { 4, 8 }))] |
136 | 136 | // FailingMergeData has enumerables that throw errors when attempting to perform the nth enumeration.
|
137 | 137 | // This test checks whether the query runs in a pipelined or buffered fashion.
|
138 | 138 | public static void Merge_Ordered_Pipelining(Labeled<ParallelQuery<int>> labeled, int count, ParallelMergeOptions options)
|
139 | 139 | {
|
140 |
| - Assert.Equal(0, labeled.Item.WithMergeOptions(options).Select(x => x).First()); |
| 140 | + Assert.Equal(0, labeled.Item.WithDegreeOfParallelism(count - 1).WithMergeOptions(options).First()); |
141 | 141 | }
|
142 | 142 |
|
143 | 143 | [Theory]
|
144 |
| - [OuterLoop] |
145 |
| - [MemberData("MergeData", (object)(new int[] { 1024 * 4, 1024 * 1024 }))] |
146 |
| - [MemberData("ThrowOnCount_AllMergeOptions_MemberData", (object)(new int[] { 1024 * 4, 1024 * 1024 }))] |
147 |
| - public static void Merge_Ordered_Pipelining_Longrunning(Labeled<ParallelQuery<int>> labeled, int count, ParallelMergeOptions options) |
| 144 | + [MemberData("MergeData", (object)(new int[] { 4, 8 }))] |
| 145 | + // This test checks whether the query runs in a pipelined or buffered fashion. |
| 146 | + public static void Merge_Ordered_Pipelining_Select(Labeled<ParallelQuery<int>> labeled, int count, ParallelMergeOptions options) |
148 | 147 | {
|
149 |
| - Merge_Ordered_Pipelining(labeled, count, options); |
| 148 | + int countdown = count; |
| 149 | + Func<int, int> down = i => |
| 150 | + { |
| 151 | + if (Interlocked.Decrement(ref countdown) == 0) throw new DeliberateTestException(); |
| 152 | + return i; |
| 153 | + }; |
| 154 | + Assert.Equal(0, labeled.Item.WithDegreeOfParallelism(count - 1).WithMergeOptions(options).Select(down).First()); |
150 | 155 | }
|
151 | 156 |
|
152 | 157 | [Theory]
|
|
0 commit comments