@@ -142,80 +142,6 @@ public async Task SelectAsync_ProcessInParallel_WithHighConcurrency_HandlesCorre
142142 await Assert . That ( results . OrderBy ( x => x ) ) . IsEquivalentTo ( Enumerable . Range ( 1 , 50 ) . Select ( x => x * 3 ) ) ;
143143 }
144144
145- [ Test ]
146- public async Task ForEachAsync_ProcessWithChannel_ProcessesAllItems ( )
147- {
148- var processedItems = new List < int > ( ) ;
149- var asyncEnumerable = GenerateAsyncEnumerable ( 30 ) ;
150-
151- await asyncEnumerable
152- . ForEachAsync ( async item =>
153- {
154- await Task . Delay ( 5 ) ;
155- lock ( processedItems )
156- {
157- processedItems . Add ( item ) ;
158- }
159- } )
160- . ProcessWithChannel ( new AsyncEnumerableChannelOptions
161- {
162- BufferSize = 10 ,
163- MaxConcurrency = 5
164- } )
165- . ExecuteAsync ( ) ;
166-
167- await Assert . That ( processedItems . Count ) . IsEqualTo ( 30 ) ;
168- await Assert . That ( processedItems . OrderBy ( x => x ) ) . IsEquivalentTo ( Enumerable . Range ( 1 , 30 ) ) ;
169- }
170-
171- [ Test ]
172- public async Task SelectAsync_ProcessWithChannel_WithOrderPreservation_MaintainsOrder ( )
173- {
174- var asyncEnumerable = GenerateAsyncEnumerable ( 20 ) ;
175- var random = new Random ( 42 ) ;
176-
177- var results = await asyncEnumerable
178- . SelectAsync ( async item =>
179- {
180- // Random delay to test order preservation
181- await Task . Delay ( random . Next ( 1 , 20 ) ) ;
182- return item * 2 ;
183- } )
184- . ProcessWithChannel ( new AsyncEnumerableChannelOptions
185- {
186- BufferSize = 5 ,
187- MaxConcurrency = 4 ,
188- PreserveOrder = true
189- } )
190- . ExecuteAsync ( )
191- . ToListAsync ( ) ;
192-
193- await Assert . That ( results . Count ) . IsEqualTo ( 20 ) ;
194- await Assert . That ( results ) . IsEquivalentTo ( Enumerable . Range ( 1 , 20 ) . Select ( x => x * 2 ) ) ;
195- }
196-
197- [ Test ]
198- public async Task SelectAsync_ProcessWithChannel_WithoutOrderPreservation_ReturnsAllItems ( )
199- {
200- var asyncEnumerable = GenerateAsyncEnumerable ( 20 ) ;
201-
202- var results = await asyncEnumerable
203- . SelectAsync ( async item =>
204- {
205- await Task . Delay ( 5 ) ;
206- return item * 2 ;
207- } )
208- . ProcessWithChannel ( new AsyncEnumerableChannelOptions
209- {
210- PreserveOrder = false ,
211- MaxConcurrency = 4
212- } )
213- . ExecuteAsync ( )
214- . ToListAsync ( ) ;
215-
216- await Assert . That ( results . Count ) . IsEqualTo ( 20 ) ;
217- await Assert . That ( results . OrderBy ( x => x ) ) . IsEquivalentTo ( Enumerable . Range ( 1 , 20 ) . Select ( x => x * 2 ) ) ;
218- }
219145
220146 [ Test ]
221147 public async Task ForEachAsync_WithCancellation_StopsProcessing ( )
0 commit comments