@@ -185,17 +185,21 @@ public async Task SuppliesCancellationTokenThatSignalsWhenRevalidationLoopIsBein
185
185
}
186
186
187
187
[ Fact ]
188
- [ QuarantinedTest ( "https://github.com/dotnet/aspnetcore/issues/19940" ) ]
189
188
public async Task IfValidateAuthenticationStateAsyncReturnsUnrelatedCancelledTask_TreatAsFailure ( )
190
189
{
191
190
// Arrange
192
191
var validationTcs = new TaskCompletionSource < bool > ( ) ;
192
+ var incrementExecuted = new TaskCompletionSource < bool > ( ) ;
193
193
var authenticationStateChangedCount = 0 ;
194
194
using var provider = new TestRevalidatingServerAuthenticationStateProvider (
195
195
TimeSpan . FromMilliseconds ( 50 ) ) ;
196
196
provider . NextValidationResult = validationTcs . Task ;
197
197
provider . SetAuthenticationState ( CreateAuthenticationStateTask ( "test user" ) ) ;
198
- provider . AuthenticationStateChanged += _ => { authenticationStateChangedCount ++ ; } ;
198
+ provider . AuthenticationStateChanged += _ =>
199
+ {
200
+ authenticationStateChangedCount ++ ;
201
+ incrementExecuted . TrySetResult ( true ) ;
202
+ } ;
199
203
200
204
// Be waiting for the first ValidateAuthenticationStateAsync to complete
201
205
await provider . NextValidateAuthenticationStateAsyncCall ;
@@ -208,6 +212,7 @@ public async Task IfValidateAuthenticationStateAsyncReturnsUnrelatedCancelledTas
208
212
209
213
// Assert: Since we didn't ask for that operation to be canceled, this is treated as
210
214
// a failure to validate, so we force a logout
215
+ await incrementExecuted . Task . TimeoutAfter ( TimeSpan . FromSeconds ( 5 ) ) ;
211
216
Assert . Equal ( 1 , authenticationStateChangedCount ) ;
212
217
var newAuthState = await provider . GetAuthenticationStateAsync ( ) ;
213
218
Assert . False ( newAuthState . User . Identity . IsAuthenticated ) ;
0 commit comments