File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,12 +50,16 @@ public void Test0003()
5050 [ Fact ( DisplayName = "DisposeComponents captures exceptions from DisposeAsync in Renderer.UnhandledException" ) ]
5151 public async Task Test201 ( )
5252 {
53- RenderComponent < AsyncThrowExceptionComponent > ( ) ;
53+ var tcs = new TaskCompletionSource ( ) ;
54+ var expected = new NotSupportedException ( ) ;
55+ RenderComponent < AsyncThrowExceptionComponent > (
56+ ps => ps . Add ( p => p . DisposedTask , tcs . Task ) ) ;
5457
5558 DisposeComponents ( ) ;
5659
57- var exception = await Renderer . UnhandledException ;
58- exception . ShouldBeOfType < NotSupportedException > ( ) ;
60+ tcs . SetException ( expected ) ;
61+ var actual = await Renderer . UnhandledException ;
62+ actual . ShouldBeSameAs ( expected ) ;
5963 }
6064
6165 [ Fact ( DisplayName = "DisposeComponents calls DisposeAsync on rendered components" ) ]
@@ -140,10 +144,12 @@ public void Dispose()
140144
141145 private sealed class AsyncThrowExceptionComponent : ComponentBase , IAsyncDisposable
142146 {
147+ [ Parameter ]
148+ public Task DisposedTask { get ; set ; }
149+
143150 public async ValueTask DisposeAsync ( )
144151 {
145- await Task . Delay ( 30 ) ;
146- throw new NotSupportedException ( ) ;
152+ await DisposedTask ;
147153 }
148154 }
149155
You can’t perform that action at this time.
0 commit comments