File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed
src/ServiceControl.Infrastructure.Tests Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -37,8 +37,8 @@ public async Task It_shuts_down_gracefully()
3737 await stopped . Task ;
3838 }
3939
40- [ Test , Ignore ( "When ensurestopped throws an exception, stop should also throw an exception as that is an ungraceful stop" ) ]
41- public async Task When_stop_fails_it_reports_the_failure ( )
40+ [ Test ]
41+ public async Task When_stop_fails_stop_should_throw_identifying_ungraceful_stop ( )
4242 {
4343 string lastFailure = null ;
4444 var started = new TaskCompletionSource < bool > ( ) ;
@@ -53,9 +53,20 @@ public async Task When_stop_fails_it_reports_the_failure()
5353
5454 await started . Task ;
5555
56- await dog . Stop ( TestContext . CurrentContext . CancellationToken ) ;
56+ // The following blocks the test:
57+ //
58+ // var ex = Assert.ThrowsAsync<Exception>(async () => await dog.Stop(TestContext.CurrentContext.CancellationToken));
59+ // Assert.That(ex.Message, Is.EqualTo("Simulated"));
5760
58- Assert . That ( lastFailure , Is . EqualTo ( "Simulated" ) ) ;
61+ try
62+ {
63+ await dog . Stop ( TestContext . CurrentContext . CancellationToken ) ;
64+ Assert . Fail ( "Should have thrown an exception" ) ;
65+ }
66+ catch ( Exception ex )
67+ {
68+ Assert . That ( ex . Message , Is . EqualTo ( "Simulated" ) ) ;
69+ }
5970 }
6071
6172 [ Test ]
@@ -76,6 +87,7 @@ public async Task On_failure_triggers_stopping()
7687 {
7788 restarted . SetResult ( true ) ;
7889 }
90+
7991 startAttempts ++ ;
8092 return Task . CompletedTask ;
8193 } , token =>
You can’t perform that action at this time.
0 commit comments