@@ -200,143 +200,137 @@ public KeepGoingStageSpec(ITestOutputHelper helper = null) : base(helper)
200
200
}
201
201
202
202
[ Fact ]
203
- public void A_stage_with_keep_going_must_still_be_alive_after_all_ports_have_been_closed_until_explicity_closed ( )
203
+ public async Task A_stage_with_keep_going_must_still_be_alive_after_all_ports_have_been_closed_until_explicity_closed ( )
204
204
{
205
- this . AssertAllStagesStopped ( ( ) =>
206
- {
205
+ await this . AssertAllStagesStoppedAsync ( async ( ) => {
207
206
var t = Source . Maybe < int > ( ) . ToMaterialized ( new PingableSink ( true ) , Keep . Both ) . Run ( Materializer ) ;
208
207
var maybePromise = t . Item1 ;
209
208
var pingerFuture = t . Item2 ;
210
209
pingerFuture . Wait ( TimeSpan . FromSeconds ( 3 ) ) . Should ( ) . BeTrue ( ) ;
211
- var pinger = pingerFuture . Result ;
210
+ var pinger = await pingerFuture ;
212
211
213
212
pinger . Register ( TestActor ) ;
214
213
215
214
//Before completion
216
215
pinger . Ping ( ) ;
217
- ExpectMsg < Pong > ( ) ;
216
+ await ExpectMsgAsync < Pong > ( ) ;
218
217
219
218
pinger . Ping ( ) ;
220
- ExpectMsg < Pong > ( ) ;
219
+ await ExpectMsgAsync < Pong > ( ) ;
221
220
222
221
maybePromise . TrySetResult ( 0 ) ;
223
- ExpectMsg < UpstreamCompleted > ( ) ;
222
+ await ExpectMsgAsync < UpstreamCompleted > ( ) ;
224
223
225
- ExpectNoMsg ( 200 ) ;
224
+ await ExpectNoMsgAsync ( 200 ) ;
226
225
227
226
pinger . Ping ( ) ;
228
- ExpectMsg < Pong > ( ) ;
227
+ await ExpectMsgAsync < Pong > ( ) ;
229
228
230
229
pinger . Stop ( ) ;
231
230
// PostStop should not be concurrent with the event handler. This event here tests this.
232
- ExpectMsg < EndOfEventHandler > ( ) ;
233
- ExpectMsg < PostStop > ( ) ;
231
+ await ExpectMsgAsync < EndOfEventHandler > ( ) ;
232
+ await ExpectMsgAsync < PostStop > ( ) ;
234
233
} , Materializer ) ;
235
234
}
236
235
237
236
[ Fact ]
238
- public void A_stage_with_keep_going_must_still_be_alive_after_all_ports_have_been_closed_until_explicitly_failed ( )
237
+ public async Task A_stage_with_keep_going_must_still_be_alive_after_all_ports_have_been_closed_until_explicitly_failed ( )
239
238
{
240
- this . AssertAllStagesStopped ( ( ) =>
241
- {
239
+ await this . AssertAllStagesStoppedAsync ( async ( ) => {
242
240
var t = Source . Maybe < int > ( ) . ToMaterialized ( new PingableSink ( true ) , Keep . Both ) . Run ( Materializer ) ;
243
241
var maybePromise = t . Item1 ;
244
242
var pingerFuture = t . Item2 ;
245
243
pingerFuture . Wait ( TimeSpan . FromSeconds ( 3 ) ) . Should ( ) . BeTrue ( ) ;
246
- var pinger = pingerFuture . Result ;
244
+ var pinger = await pingerFuture ;
247
245
248
246
pinger . Register ( TestActor ) ;
249
247
250
248
//Before completion
251
249
pinger . Ping ( ) ;
252
- ExpectMsg < Pong > ( ) ;
250
+ await ExpectMsgAsync < Pong > ( ) ;
253
251
254
252
pinger . Ping ( ) ;
255
- ExpectMsg < Pong > ( ) ;
253
+ await ExpectMsgAsync < Pong > ( ) ;
256
254
257
255
maybePromise . TrySetResult ( 0 ) ;
258
- ExpectMsg < UpstreamCompleted > ( ) ;
256
+ await ExpectMsgAsync < UpstreamCompleted > ( ) ;
259
257
260
- ExpectNoMsg ( 200 ) ;
258
+ await ExpectNoMsgAsync ( 200 ) ;
261
259
262
260
pinger . Ping ( ) ;
263
- ExpectMsg < Pong > ( ) ;
261
+ await ExpectMsgAsync < Pong > ( ) ;
264
262
265
263
pinger . Ping ( ) ;
266
- ExpectMsg < Pong > ( ) ;
264
+ await ExpectMsgAsync < Pong > ( ) ;
267
265
268
266
pinger . Fail ( ) ;
269
267
// PostStop should not be concurrent with the event handler. This event here tests this.
270
- ExpectMsg < EndOfEventHandler > ( ) ;
271
- ExpectMsg < PostStop > ( ) ;
272
-
268
+ await ExpectMsgAsync < EndOfEventHandler > ( ) ;
269
+ await ExpectMsgAsync < PostStop > ( ) ;
273
270
} , Materializer ) ;
274
271
}
275
272
276
273
[ Fact ]
277
- public void A_stage_with_keep_going_must_still_be_alive_after_all_ports_have_been_closed_until_implicity_failed_via_exception ( )
274
+ public async Task A_stage_with_keep_going_must_still_be_alive_after_all_ports_have_been_closed_until_implicity_failed_via_exception ( )
278
275
{
279
- this . AssertAllStagesStopped ( ( ) =>
280
- {
276
+ await this . AssertAllStagesStoppedAsync ( async ( ) => {
281
277
var t = Source . Maybe < int > ( ) . ToMaterialized ( new PingableSink ( true ) , Keep . Both ) . Run ( Materializer ) ;
282
278
var maybePromise = t . Item1 ;
283
279
var pingerFuture = t . Item2 ;
284
280
pingerFuture . Wait ( TimeSpan . FromSeconds ( 3 ) ) . Should ( ) . BeTrue ( ) ;
285
- var pinger = pingerFuture . Result ;
281
+ var pinger = await pingerFuture ;
286
282
287
283
pinger . Register ( TestActor ) ;
288
284
289
285
//Before completion
290
286
pinger . Ping ( ) ;
291
- ExpectMsg < Pong > ( ) ;
287
+ await ExpectMsgAsync < Pong > ( ) ;
292
288
293
289
pinger . Ping ( ) ;
294
- ExpectMsg < Pong > ( ) ;
290
+ await ExpectMsgAsync < Pong > ( ) ;
295
291
296
292
maybePromise . TrySetResult ( 0 ) ;
297
- ExpectMsg < UpstreamCompleted > ( ) ;
293
+ await ExpectMsgAsync < UpstreamCompleted > ( ) ;
298
294
299
295
ExpectNoMsg ( 200 ) ;
300
296
301
297
pinger . Ping ( ) ;
302
- ExpectMsg < Pong > ( ) ;
298
+ await ExpectMsgAsync < Pong > ( ) ;
303
299
304
300
pinger . Ping ( ) ;
305
- ExpectMsg < Pong > ( ) ;
301
+ await ExpectMsgAsync < Pong > ( ) ;
306
302
307
303
// We need to catch the exception otherwise the test fails
308
304
// ReSharper disable once EmptyGeneralCatchClause
309
- try { pinger . ThrowEx ( ) ; } catch { }
305
+ try { pinger . ThrowEx ( ) ; } catch { }
310
306
// PostStop should not be concurrent with the event handler. This event here tests this.
311
- ExpectMsg < EndOfEventHandler > ( ) ;
312
- ExpectMsg < PostStop > ( ) ;
313
-
307
+ await ExpectMsgAsync < EndOfEventHandler > ( ) ;
308
+ await ExpectMsgAsync < PostStop > ( ) ;
314
309
} , Materializer ) ;
315
310
}
316
311
317
312
[ Fact ]
318
- public void A_stage_with_keep_going_must_close_down_earls_if_keepAlive_is_not_requested ( )
313
+ public async Task A_stage_with_keep_going_must_close_down_earls_if_keepAlive_is_not_requested ( )
319
314
{
320
- this . AssertAllStagesStopped ( ( ) =>
321
- {
315
+ await this . AssertAllStagesStoppedAsync ( async ( ) => {
322
316
var t = Source . Maybe < int > ( ) . ToMaterialized ( new PingableSink ( false ) , Keep . Both ) . Run ( Materializer ) ;
323
317
var maybePromise = t . Item1 ;
324
318
var pingerFuture = t . Item2 ;
325
319
pingerFuture . Wait ( TimeSpan . FromSeconds ( 3 ) ) . Should ( ) . BeTrue ( ) ;
326
- var pinger = pingerFuture . Result ;
320
+ var pinger = await pingerFuture ;
327
321
328
322
pinger . Register ( TestActor ) ;
329
323
330
324
//Before completion
331
325
pinger . Ping ( ) ;
332
- ExpectMsg < Pong > ( ) ;
326
+ await ExpectMsgAsync < Pong > ( ) ;
333
327
334
328
pinger . Ping ( ) ;
335
- ExpectMsg < Pong > ( ) ;
329
+ await ExpectMsgAsync < Pong > ( ) ;
336
330
337
331
maybePromise . TrySetResult ( 0 ) ;
338
- ExpectMsg < UpstreamCompleted > ( ) ;
339
- ExpectMsg < PostStop > ( ) ;
332
+ await ExpectMsgAsync < UpstreamCompleted > ( ) ;
333
+ await ExpectMsgAsync < PostStop > ( ) ;
340
334
} , Materializer ) ;
341
335
}
342
336
}
0 commit comments