Skip to content

Commit

Permalink
Use Assert.ThrowsAnyAsync
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCodeTraveler committed Jan 29, 2025
1 parent 4167445 commit a9afa89
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ static void MapOnOpened(MockPopupHandler arg1, IPopup arg2, object? arg3)

static void MapOnClosed(MockPopupHandler handler, IPopup view, object? result)
{
view.HandlerCompleteTCS.SetResult();
view.HandlerCompleteTCS.TrySetResult();
}
}
8 changes: 4 additions & 4 deletions src/CommunityToolkit.Maui.UnitTests/Views/Popup/PopupTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public async Task ShowPopupAsync_CancellationTokenExpired()
// Ensure CancellationToken Has Expired
await Task.Delay(100, CancellationToken.None);

await Assert.ThrowsAsync<OperationCanceledException>(() => page.ShowPopupAsync(popup, cts.Token));
await Assert.ThrowsAnyAsync<OperationCanceledException>(() => page.ShowPopupAsync(popup, cts.Token));
}

[Fact(Timeout = (int)TestDuration.Short)]
Expand Down Expand Up @@ -86,7 +86,7 @@ public async Task ShowPopupAsync_CancellationTokenCancelled()
// Ensure CancellationToken Has Expired
await cts.CancelAsync();

await Assert.ThrowsAsync<OperationCanceledException>(() => page.ShowPopupAsync(popup, cts.Token));
await Assert.ThrowsAnyAsync<OperationCanceledException>(() => page.ShowPopupAsync(popup, cts.Token));
}

[Fact(Timeout = (int)TestDuration.Short)]
Expand Down Expand Up @@ -115,7 +115,7 @@ public async Task CloseAsync_CancellationTokenExpired()
// Ensure CancellationToken Has Expired
await Task.Delay(100, CancellationToken.None);

await Assert.ThrowsAsync<OperationCanceledException>(() => popup.CloseAsync(token: cts.Token));
await Assert.ThrowsAnyAsync<OperationCanceledException>(() => popup.CloseAsync(token: cts.Token));
}

[Fact(Timeout = (int)TestDuration.Short)]
Expand Down Expand Up @@ -144,7 +144,7 @@ public async Task CloseAsync_CancellationTokenCancelled()
// Ensure CancellationToken Has Expired
await cts.CancelAsync();

await Assert.ThrowsAsync<OperationCanceledException>(() => popup.CloseAsync(token: cts.Token));
await Assert.ThrowsAnyAsync<OperationCanceledException>(() => popup.CloseAsync(token: cts.Token));
}

[Fact(Timeout = (int)TestDuration.Short)]
Expand Down

0 comments on commit a9afa89

Please sign in to comment.