Skip to content

feat: support async wait handlers#942

Merged
vbreuss merged 7 commits intomainfrom
topic/improve-notifications
Feb 19, 2026
Merged

feat: support async wait handlers#942
vbreuss merged 7 commits intomainfrom
topic/improve-notifications

Conversation

@vbreuss
Copy link
Member

@vbreuss vbreuss commented Feb 18, 2026

This pull request adds async wait handler support to the IAwaitableCallback<TValue> interface by introducing a new WaitAsync method. The changes enable asynchronous waiting for callbacks using modern async/await patterns with cancellation token support.

Key Changes:

  • Added WaitAsync method to IAwaitableCallback<TValue> for asynchronous waiting with cancellation support
  • Refactored the interface to change the generic constraint from out TValue (covariant) to TValue (invariant) to support returning arrays
  • Implemented channel-based async infrastructure using System.Threading.Channels for efficient value buffering
  • Added comprehensive test coverage for the new WaitAsync functionality
  • Updated API surface files across all target frameworks (.NET 6.0, 8.0, 9.0, 10.0, netstandard2.0, netstandard2.1)

@vbreuss vbreuss self-assigned this Feb 18, 2026
@vbreuss vbreuss added enhancement New feature or request breaking change The changes require a new major version labels Feb 18, 2026
@vbreuss vbreuss marked this pull request as ready for review February 18, 2026 07:16
Copilot AI review requested due to automatic review settings February 18, 2026 07:16
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds async wait handler support to the IAwaitableCallback<TValue> interface by introducing a new WaitAsync method. The changes enable asynchronous waiting for callbacks using modern async/await patterns with cancellation token support.

Changes:

  • Added WaitAsync method to IAwaitableCallback<TValue> for asynchronous waiting with cancellation support
  • Refactored the interface to change the generic constraint from out TValue (covariant) to TValue (invariant) to support returning arrays
  • Marked the old ExecuteWhileWaiting methods as obsolete, encouraging users to execute callbacks before calling Wait/WaitAsync
  • Implemented channel-based async infrastructure using System.Threading.Channels for efficient value buffering
  • Added comprehensive test coverage for the new WaitAsync functionality
  • Updated API surface files across all target frameworks (.NET 6.0, 8.0, 9.0, 10.0, netstandard2.0, netstandard2.1)

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
Source/Testably.Abstractions.Testing/IAwaitableCallback.cs Added new WaitAsync method and updated Wait method signatures; changed generic constraint from covariant to invariant
Source/Testably.Abstractions.Testing/Notification.cs Implemented channel-based async infrastructure with WaitAsync support; marked ExecuteWhileWaiting as obsolete
Source/Testably.Abstractions.Testing/AwaitableCallbackExtensions.cs New extension methods providing backward-compatible overloads for Wait/WaitAsync with int timeout parameters
Source/Testably.Abstractions.Testing/Helpers/ExceptionFactory.cs Added TimeSpan overload for TimeoutExpired exception factory method
Tests/Testably.Abstractions.Testing.Tests/NotificationTests.cs Updated existing tests to use new API, marked obsolete filter tests with Obsolete attribute
Tests/Testably.Abstractions.Testing.Tests/NotificationTests.WaitAsync.cs New test file with comprehensive WaitAsync test coverage including cancellation, disposal, and multiple wait scenarios
Tests/Testably.Abstractions.Testing.Tests/NotificationHandlerExtensionsTests.cs Refactored tests to execute callbacks before Wait instead of using ExecuteWhileWaiting
Tests/Testably.Abstractions.Testing.Tests/FileSystem/ChangeHandlerTests.cs Updated tests to use new Wait API pattern
Tests/Api/Testably.Abstractions.Api.Tests/Expected/*.txt Updated API surface files for all target frameworks to reflect new public API

@github-actions
Copy link

github-actions bot commented Feb 18, 2026

Test Results

     52 files  ±  0       52 suites  ±0   36m 12s ⏱️ + 1m 28s
 63 908 tests + 24   60 293 ✅ + 24   3 615 💤 ±0  0 ❌ ±0 
132 002 runs  +115  117 458 ✅ +115  14 544 💤 ±0  0 ❌ ±0 

Results for commit 5993198. ± Comparison against base commit cbb6349.

♻️ This comment has been updated with latest results.

@vbreuss vbreuss force-pushed the topic/improve-notifications branch from d11fe3e to 5993198 Compare February 18, 2026 19:12
@vbreuss vbreuss removed the breaking change The changes require a new major version label Feb 18, 2026
@vbreuss vbreuss force-pushed the topic/improve-notifications branch from 15bf554 to 7cbff9c Compare February 19, 2026 19:26
@vbreuss vbreuss force-pushed the topic/improve-notifications branch from 6a593c8 to 955bbb7 Compare February 19, 2026 19:53
@vbreuss vbreuss enabled auto-merge (squash) February 19, 2026 19:54
@sonarqubecloud
Copy link

@vbreuss vbreuss merged commit 0ba083b into main Feb 19, 2026
13 checks passed
@vbreuss vbreuss deleted the topic/improve-notifications branch February 19, 2026 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MockFileSystem.File.Move raises FileSystemWatcher event with delay #2

1 participant

Comments