@@ -50,7 +50,7 @@ public sealed record CollectArgs(
5050 [ MemberData ( nameof ( BasicCases ) ) ]
5151 public async Task CollectCommandProviderConfigurationConsolidation ( CollectArgs args , string [ ] expectedSubset )
5252 {
53- MockConsole console = new ( 200 , 30 ) { IsOutputRedirected = false } ;
53+ MockConsole console = new ( 200 , 30 ) ;
5454 string [ ] rawLines = await RunAsync ( args , console ) . ConfigureAwait ( true ) ;
5555 console . AssertSanitizedLinesEqual ( CollectSanitizer , expectedSubset ) ;
5656
@@ -63,9 +63,8 @@ private static async Task<string[]> RunAsync(CollectArgs config, MockConsole con
6363 var handler = new CollectCommandHandler ( ) ;
6464 handler . StartTraceSessionAsync = ( client , cfg , ct ) => Task . FromResult < CollectCommandHandler . ICollectSession > ( new TestCollectSession ( ) ) ;
6565 handler . ResumeRuntimeAsync = ( client , ct ) => Task . CompletedTask ;
66- handler . CollectSessionEventStream = ( name ) => new SlowSinkStream ( config . EventStream ) ;
66+ handler . CollectSessionEventStream = ( name ) => config . EventStream ;
6767 handler . Console = console ;
68- handler . FileSizeForStatus = Encoding . UTF8 . GetByteCount ( ExpectedPayload ) ;
6968
7069 int exit = await handler . Collect (
7170 config . ct ,
@@ -96,32 +95,6 @@ private static async Task<string[]> RunAsync(CollectArgs config, MockConsole con
9695 return console . Lines ;
9796 }
9897
99- // As the test payload is small, we need to delay writes to the output stream to ensure
100- // that the status update logic in CollectCommandHandler has a chance to run.
101- private sealed class SlowSinkStream : Stream
102- {
103- private readonly Stream _inner ;
104-
105- public SlowSinkStream ( Stream inner ) { _inner = inner ; }
106-
107- public override bool CanRead => false ;
108- public override bool CanSeek => false ;
109- public override bool CanWrite => true ;
110- public override long Length => throw new NotSupportedException ( ) ;
111- public override long Position { get => throw new NotSupportedException ( ) ; set => throw new NotSupportedException ( ) ; }
112-
113- public override void Flush ( ) { }
114- public override int Read ( byte [ ] buffer , int offset , int count ) => throw new NotSupportedException ( ) ;
115- public override long Seek ( long offset , SeekOrigin origin ) => throw new NotSupportedException ( ) ;
116- public override void SetLength ( long value ) => throw new NotSupportedException ( ) ;
117- public override void Write ( byte [ ] buffer , int offset , int count ) => _inner . Write ( buffer , offset , count ) ;
118- public override async Task WriteAsync ( byte [ ] buffer , int offset , int count , CancellationToken cancellationToken )
119- {
120- await Task . Delay ( 200 , cancellationToken ) . ConfigureAwait ( false ) ;
121- await _inner . WriteAsync ( buffer , offset , count , cancellationToken ) . ConfigureAwait ( false ) ;
122- }
123- }
124-
12598 private static string [ ] CollectSanitizer ( string [ ] lines )
12699 {
127100 List < string > result = new ( ) ;
@@ -131,10 +104,6 @@ private static string[] CollectSanitizer(string[] lines)
131104 {
132105 result . Add ( "Process : <PROCESS>" ) ;
133106 }
134- else if ( line . StartsWith ( '[' ) && line . Contains ( "Recording trace" ) )
135- {
136- result . Add ( "[dd:hh:mm:ss]\t " + line . Substring ( 14 ) ) ;
137- }
138107 else
139108 {
140109 result . Add ( line ) ;
@@ -250,8 +219,7 @@ public static IEnumerable<object[]> BasicCases()
250219 private static readonly string [ ] CommonTail = [
251220 "Process : <PROCESS>" ,
252221 outputFile ,
253- "[dd:hh:mm:ss]\t Recording trace 38.00 (B)" ,
254- "Press <Enter> or <Ctrl+C> to exit..." ,
222+ "" ,
255223 "\n Trace completed."
256224 ] ;
257225
0 commit comments