File tree Expand file tree Collapse file tree
Open.ChannelExtensions.Tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -330,32 +330,4 @@ public static async Task Filter(int testSize)
330330 Assert . Equal ( count , result . Count ) ;
331331 Assert . True ( result . SequenceEqual ( range . Where ( i => i % 2 == 1 ) ) ) ;
332332 }
333-
334- [ Fact ]
335- public static void PossibleSourceLoadingIssue ( )
336- {
337- const int expectedCount = 10000000 ;
338- int count_ = 0 ;
339-
340- var queue = new BlockingCollection < int > ( ) ;
341- var processingTask = StartProcessingTask2 ( queue . GetConsumingEnumerable ( ) ) ;
342-
343- for ( var i = 0 ; i < expectedCount ; i ++ )
344- queue . Add ( i ) ;
345-
346- queue . CompleteAdding ( ) ;
347-
348- processingTask . Wait ( ) ;
349-
350- Assert . Equal ( expectedCount , count_ ) ;
351-
352- Task StartProcessingTask2 ( IEnumerable < int > source )
353- => Channel . CreateUnbounded < int > ( )
354- . Source ( source , true )
355- . ReadAll ( IncrementCount2 )
356- . AsTask ( ) ;
357-
358- void IncrementCount2 ( int c )
359- => Interlocked . Increment ( ref count_ ) ;
360- }
361333}
Original file line number Diff line number Diff line change 22
33 <PropertyGroup >
44 <OutputType >Exe</OutputType >
5- <TargetFrameworks >net472; net5.0;</TargetFrameworks >
5+ <TargetFramework > net5.0;</TargetFramework >
66 <LangVersion >latest</LangVersion >
77 <IsPackable >false</IsPackable >
88 </PropertyGroup >
Original file line number Diff line number Diff line change 33internal class Program
44{
55#if NET472
6- public static void Main ( string [ ] args ) { }
6+ public static void Main ( ) { }
77#endif
88}
Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Collections . Concurrent ;
3+ using System . Collections . Generic ;
4+ using System . Linq ;
5+ using System . Text ;
6+ using System . Threading ;
7+ using System . Threading . Channels ;
8+ using System . Threading . Tasks ;
9+ using Xunit ;
10+ using Xunit . Abstractions ;
11+
12+ namespace Open . ChannelExtensions . Tests ;
13+
14+ public class SpecialTests
15+ {
16+ private readonly ITestOutputHelper output ;
17+
18+ public SpecialTests ( ITestOutputHelper outputHelper )
19+ {
20+ output = outputHelper ;
21+ }
22+
23+ [ Fact ]
24+ public void PossibleSourceLoadingIssue ( )
25+ {
26+ const int expectedCount = 10000000 ;
27+ int count_ = 0 ;
28+
29+ var queue = new BlockingCollection < int > ( ) ;
30+ var processingTask = StartProcessingTask2 ( queue . GetConsumingEnumerable ( ) ) ;
31+
32+ Console . WriteLine ( "Starting to fill queue." ) ;
33+ for ( var i = 0 ; i < expectedCount ; i ++ )
34+ queue . Add ( i ) ;
35+
36+ Console . WriteLine ( "Queue fill complete." ) ;
37+
38+ queue . CompleteAdding ( ) ;
39+
40+ processingTask . Wait ( ) ;
41+
42+ Assert . Equal ( expectedCount , count_ ) ;
43+
44+ Task StartProcessingTask2 ( IEnumerable < int > source )
45+ => Channel . CreateUnbounded < int > ( )
46+ . Source ( source , true )
47+ . ReadAll ( IncrementCount2 )
48+ . AsTask ( ) ;
49+
50+ void IncrementCount2 ( int c )
51+ => Interlocked . Increment ( ref count_ ) ;
52+ }
53+ }
You can’t perform that action at this time.
0 commit comments