File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -50,12 +50,16 @@ public void Test0003()
50
50
[ Fact ( DisplayName = "DisposeComponents captures exceptions from DisposeAsync in Renderer.UnhandledException" ) ]
51
51
public async Task Test201 ( )
52
52
{
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 ) ) ;
54
57
55
58
DisposeComponents ( ) ;
56
59
57
- var exception = await Renderer . UnhandledException ;
58
- exception . ShouldBeOfType < NotSupportedException > ( ) ;
60
+ tcs . SetException ( expected ) ;
61
+ var actual = await Renderer . UnhandledException ;
62
+ actual . ShouldBeSameAs ( expected ) ;
59
63
}
60
64
61
65
[ Fact ( DisplayName = "DisposeComponents calls DisposeAsync on rendered components" ) ]
@@ -140,10 +144,12 @@ public void Dispose()
140
144
141
145
private sealed class AsyncThrowExceptionComponent : ComponentBase , IAsyncDisposable
142
146
{
147
+ [ Parameter ]
148
+ public Task DisposedTask { get ; set ; }
149
+
143
150
public async ValueTask DisposeAsync ( )
144
151
{
145
- await Task . Delay ( 30 ) ;
146
- throw new NotSupportedException ( ) ;
152
+ await DisposedTask ;
147
153
}
148
154
}
149
155
You can’t perform that action at this time.
0 commit comments