@@ -275,7 +275,7 @@ public void Should_sleep_for_the_specified_duration_each_retry_when_specified_ex
275275 }
276276
277277 [ Fact ]
278- public void Should_sleep_for_the_specified_duration_each_retry_when_specified_exception_thrown_less_number_of_times_than_there_are_sleep_durations ( )
278+ public async Task Should_sleep_for_the_specified_duration_each_retry_when_specified_exception_thrown_less_number_of_times_than_there_are_sleep_durations ( )
279279 {
280280 var totalTimeSlept = 0 ;
281281
@@ -294,7 +294,7 @@ public void Should_sleep_for_the_specified_duration_each_retry_when_specified_ex
294294 return TaskHelper . EmptyTask ;
295295 } ;
296296
297- policy . RaiseExceptionAsync < DivideByZeroException > ( 2 ) ;
297+ await policy . RaiseExceptionAsync < DivideByZeroException > ( 2 ) ;
298298
299299 totalTimeSlept . Should ( )
300300 . Be ( 1 + 2 ) ;
@@ -323,7 +323,7 @@ public void Should_not_sleep_if_no_retries()
323323 }
324324
325325 [ Fact ]
326- public void Should_call_onretry_on_each_retry_with_the_current_timespan ( )
326+ public async Task Should_call_onretry_on_each_retry_with_the_current_timespan ( )
327327 {
328328 var expectedRetryWaits = new [ ]
329329 {
@@ -343,14 +343,14 @@ public void Should_call_onretry_on_each_retry_with_the_current_timespan()
343343 3 . Seconds ( )
344344 } , ( _ , timeSpan ) => actualRetryWaits . Add ( timeSpan ) ) ;
345345
346- policy . RaiseExceptionAsync < DivideByZeroException > ( 3 ) ;
346+ await policy . RaiseExceptionAsync < DivideByZeroException > ( 3 ) ;
347347
348348 actualRetryWaits . Should ( )
349349 . ContainInOrder ( expectedRetryWaits ) ;
350350 }
351351
352352 [ Fact ]
353- public void Should_call_onretry_on_each_retry_with_the_current_exception ( )
353+ public async Task Should_call_onretry_on_each_retry_with_the_current_exception ( )
354354 {
355355 var expectedExceptions = new object [ ] { "Exception #1" , "Exception #2" , "Exception #3" } ;
356356 var retryExceptions = new List < Exception > ( ) ;
@@ -364,7 +364,7 @@ public void Should_call_onretry_on_each_retry_with_the_current_exception()
364364 3 . Seconds ( )
365365 } , ( exception , _ ) => retryExceptions . Add ( exception ) ) ;
366366
367- policy . RaiseExceptionAsync < DivideByZeroException > ( 3 , ( e , i ) => e . HelpLink = "Exception #" + i ) ;
367+ await policy . RaiseExceptionAsync < DivideByZeroException > ( 3 , ( e , i ) => e . HelpLink = "Exception #" + i ) ;
368368
369369 retryExceptions
370370 . Select ( x => x . HelpLink )
@@ -373,7 +373,7 @@ public void Should_call_onretry_on_each_retry_with_the_current_exception()
373373 }
374374
375375 [ Fact ]
376- public void Should_call_onretry_on_each_retry_with_the_current_retry_count ( )
376+ public async Task Should_call_onretry_on_each_retry_with_the_current_retry_count ( )
377377 {
378378 var expectedRetryCounts = new [ ] { 1 , 2 , 3 } ;
379379 var retryCounts = new List < int > ( ) ;
@@ -387,7 +387,7 @@ public void Should_call_onretry_on_each_retry_with_the_current_retry_count()
387387 3 . Seconds ( )
388388 } , ( _ , __ , retryCount , ___ ) => retryCounts . Add ( retryCount ) ) ;
389389
390- policy . RaiseExceptionAsync < DivideByZeroException > ( 3 ) ;
390+ await policy . RaiseExceptionAsync < DivideByZeroException > ( 3 ) ;
391391
392392 retryCounts . Should ( )
393393 . ContainInOrder ( expectedRetryCounts ) ;
@@ -426,7 +426,7 @@ public void Should_create_new_state_for_each_call_to_policy()
426426 }
427427
428428 [ Fact ]
429- public void Should_call_onretry_with_the_passed_context ( )
429+ public async Task Should_call_onretry_with_the_passed_context ( )
430430 {
431431 IDictionary < string , object > contextData = null ;
432432
@@ -439,7 +439,7 @@ public void Should_call_onretry_with_the_passed_context()
439439 3 . Seconds ( )
440440 } , ( _ , __ , context ) => contextData = context ) ;
441441
442- policy . RaiseExceptionAsync < DivideByZeroException > (
442+ await policy . RaiseExceptionAsync < DivideByZeroException > (
443443 new { key1 = "value1" , key2 = "value2" } . AsDictionary ( )
444444 ) ;
445445
@@ -461,14 +461,14 @@ public void Context_should_be_empty_if_execute_not_called_with_any_data()
461461 2 . Seconds ( ) ,
462462 3 . Seconds ( )
463463 } , ( _ , __ , context ) => capturedContext = context ) ;
464- policy . RaiseExceptionAsync < DivideByZeroException > ( ) ;
464+ policy . Awaiting ( async x => await x . RaiseExceptionAsync < DivideByZeroException > ( ) ) . ShouldNotThrow ( ) ;
465465
466466 capturedContext . Should ( )
467467 . BeEmpty ( ) ;
468468 }
469469
470470 [ Fact ]
471- public void Should_create_new_context_for_each_call_to_execute ( )
471+ public async Task Should_create_new_context_for_each_call_to_execute ( )
472472 {
473473 string contextValue = null ;
474474
@@ -480,13 +480,13 @@ public void Should_create_new_context_for_each_call_to_execute()
480480 } ,
481481 ( _ , __ , context ) => contextValue = context [ "key" ] . ToString ( ) ) ;
482482
483- policy . RaiseExceptionAsync < DivideByZeroException > (
483+ await policy . RaiseExceptionAsync < DivideByZeroException > (
484484 new { key = "original_value" } . AsDictionary ( )
485485 ) ;
486486
487487 contextValue . Should ( ) . Be ( "original_value" ) ;
488488
489- policy . RaiseExceptionAsync < DivideByZeroException > (
489+ await policy . RaiseExceptionAsync < DivideByZeroException > (
490490 new { key = "new_value" } . AsDictionary ( )
491491 ) ;
492492
@@ -533,7 +533,7 @@ public void Should_throw_when_onretry_action_is_null_without_context_when_using_
533533 }
534534
535535 [ Fact ]
536- public void Should_calculate_retry_timespans_from_current_retry_attempt_and_timespan_provider ( )
536+ public async Task Should_calculate_retry_timespans_from_current_retry_attempt_and_timespan_provider ( )
537537 {
538538 var expectedRetryWaits = new [ ]
539539 {
@@ -553,7 +553,7 @@ public void Should_calculate_retry_timespans_from_current_retry_attempt_and_time
553553 ( _ , timeSpan ) => actualRetryWaits . Add ( timeSpan )
554554 ) ;
555555
556- policy . RaiseExceptionAsync < DivideByZeroException > ( 5 ) ;
556+ await policy . RaiseExceptionAsync < DivideByZeroException > ( 5 ) ;
557557
558558 actualRetryWaits . Should ( )
559559 . ContainInOrder ( expectedRetryWaits ) ;
0 commit comments