9
9
using System . Collections . Generic ;
10
10
using System . IO ;
11
11
using System . Linq ;
12
+ using System . Threading . Tasks ;
12
13
using Akka . IO ;
13
14
using Akka . Streams . Dsl ;
14
15
using Akka . Streams . TestKit ;
@@ -174,23 +175,22 @@ public void InputStreamSource_must_not_signal_when_no_demand()
174
175
}
175
176
176
177
[ Fact ]
177
- public void InputStreamSource_must_read_bytes_from_InputStream ( )
178
+ public async Task InputStreamSource_must_read_bytes_from_InputStream ( )
178
179
{
179
- this . AssertAllStagesStopped ( ( ) =>
180
- {
181
- var f = StreamConverters . FromInputStream ( ( ) => new ListInputStream ( new [ ] { "a" , "b" , "c" } ) )
182
- . RunWith ( Sink . First < ByteString > ( ) , _materializer ) ;
180
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
181
+ var f = StreamConverters . FromInputStream ( ( ) => new ListInputStream ( new [ ] { "a" , "b" , "c" } ) )
182
+ . RunWith ( Sink . First < ByteString > ( ) , _materializer ) ;
183
183
184
184
f . Wait ( TimeSpan . FromSeconds ( 3 ) ) . Should ( ) . BeTrue ( ) ;
185
185
f . Result . Should ( ) . BeEquivalentTo ( ByteString . FromString ( "abc" ) ) ;
186
+ return Task . CompletedTask ;
186
187
} , _materializer ) ;
187
188
}
188
189
189
190
[ Fact ]
190
- public void InputStreamSource_must_emit_as_soon_as_read ( )
191
+ public async Task InputStreamSource_must_emit_as_soon_as_read ( )
191
192
{
192
- this . AssertAllStagesStopped ( ( ) =>
193
- {
193
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
194
194
var latch = new TestLatch ( 1 ) ;
195
195
var probe = StreamConverters . FromInputStream ( ( ) => new EmittedInputStream ( latch ) , chunkSize : 1 )
196
196
. RunWith ( this . SinkProbe < ByteString > ( ) , _materializer ) ;
@@ -199,6 +199,7 @@ public void InputStreamSource_must_emit_as_soon_as_read()
199
199
probe . ExpectNext ( ByteString . FromString ( "M" ) ) ;
200
200
latch . CountDown ( ) ;
201
201
probe . ExpectComplete ( ) ;
202
+ return Task . CompletedTask ;
202
203
} , _materializer ) ;
203
204
}
204
205
}
0 commit comments