@@ -185,17 +185,20 @@ 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
+ authenticationStateChangedCount ++ ;
200
+ incrementExecuted . TrySetResult ( true ) ;
201
+ } ;
199
202
200
203
// Be waiting for the first ValidateAuthenticationStateAsync to complete
201
204
await provider . NextValidateAuthenticationStateAsyncCall ;
@@ -208,6 +211,7 @@ public async Task IfValidateAuthenticationStateAsyncReturnsUnrelatedCancelledTas
208
211
209
212
// Assert: Since we didn't ask for that operation to be canceled, this is treated as
210
213
// a failure to validate, so we force a logout
214
+ await incrementExecuted . Task . TimeoutAfter ( TimeSpan . FromSeconds ( 1 ) ) ;
211
215
Assert . Equal ( 1 , authenticationStateChangedCount ) ;
212
216
var newAuthState = await provider . GetAuthenticationStateAsync ( ) ;
213
217
Assert . False ( newAuthState . User . Identity . IsAuthenticated ) ;
0 commit comments