Skip to content

Commit d62f9c4

Browse files
committed
Updsate LazyView LoadAsync test to allow indefinite wait for toekn expiry, and fall back to TestDuration to timeout the test.
1 parent 46d6e69 commit d62f9c4

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/CommunityToolkit.Maui.UnitTests/Views/LazyView/LazyViewTests.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ public async Task LoadViewAsync_CancellationTokenExpired()
2020
var lazyView = new LazyView<Button>();
2121

2222
// Ensure CancellationToken Expired
23-
await Task.Delay(100, TestContext.Current.CancellationToken);
23+
while (!cts.Token.IsCancellationRequested)
24+
{
25+
await Task.Delay(1, TestContext.Current.CancellationToken);
26+
}
2427

2528
await Assert.ThrowsAsync<OperationCanceledException>(async () => await lazyView.LoadViewAsync(cts.Token));
2629
}

0 commit comments

Comments
 (0)