Skip to content

feat: add callback for PeriodicTimer - #989

Merged
vbreuss merged 3 commits into
mainfrom
topic/add-periodictimer-callback
Apr 9, 2026
Merged

feat: add callback for PeriodicTimer#989
vbreuss merged 3 commits into
mainfrom
topic/add-periodictimer-callback

Conversation

@vbreuss

@vbreuss vbreuss commented Apr 9, 2026

Copy link
Copy Markdown
Member

This PR adds an extensibility/notification callback that fires when a mocked IPeriodicTimer is waiting for its next tick, aligning PeriodicTimer with the existing MockTimeSystem.On.* notification pattern.

Changes:

  • Introduces IPeriodicTimerNotificationHandler and exposes it via INotificationHandler.PeriodicTimer (feature-gated).
  • Wires PeriodicTimerMock.WaitForNextTickAsync to invoke the new notification via NotificationHandler.
  • Adds test coverage for callback invocation, disposal behavior, multiple callbacks, and predicate filtering.

@vbreuss vbreuss self-assigned this Apr 9, 2026
Copilot AI review requested due to automatic review settings April 9, 2026 19:18
@vbreuss vbreuss added the enhancement New feature or request label Apr 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds an extensibility/notification callback that fires when a mocked IPeriodicTimer is waiting for its next tick, aligning PeriodicTimer with the existing MockTimeSystem.On.* notification pattern.

Changes:

  • Introduces IPeriodicTimerNotificationHandler and exposes it via INotificationHandler.PeriodicTimer (feature-gated).
  • Wires PeriodicTimerMock.WaitForNextTickAsync to invoke the new notification via NotificationHandler.
  • Adds test coverage for callback invocation, disposal behavior, multiple callbacks, and predicate filtering.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Tests/Testably.Abstractions.Testing.Tests/TimeSystem/PeriodicTimerMockTests.cs Adds tests validating the callback behavior from the PeriodicTimerMock perspective.
Tests/Testably.Abstractions.Testing.Tests/TimeSystem/NotificationHandlerTests.cs Adds tests validating notification registration/disposal, multiple callbacks, and predicate filtering.
Source/Testably.Abstractions.Testing/TimeSystem/PeriodicTimerMock.cs Invokes notification when WaitForNextTickAsync is called; stores callback handler.
Source/Testably.Abstractions.Testing/TimeSystem/PeriodicTimerFactoryMock.cs Passes the callback handler into created PeriodicTimerMock instances.
Source/Testably.Abstractions.Testing/TimeSystem/NotificationHandler.cs Implements the new periodic-timer notification registration + invocation.
Source/Testably.Abstractions.Testing/TimeSystem/IPeriodicTimerNotificationHandler.cs Adds the public interface describing the periodic timer notifications (feature-gated).
Source/Testably.Abstractions.Testing/TimeSystem/INotificationHandler.cs Exposes PeriodicTimer notifications off MockTimeSystem.On (feature-gated).
Source/Testably.Abstractions.Testing/MockTimeSystem.cs Wires NotificationHandler into the periodic timer factory so notifications can be raised.

Comment thread Source/Testably.Abstractions.Testing/TimeSystem/NotificationHandler.cs Outdated
@vbreuss
vbreuss enabled auto-merge (squash) April 9, 2026 19:36
@sonarqubecloud

sonarqubecloud Bot commented Apr 9, 2026

Copy link
Copy Markdown

@vbreuss
vbreuss disabled auto-merge April 9, 2026 20:00
@vbreuss
vbreuss enabled auto-merge (squash) April 9, 2026 20:01
@vbreuss
vbreuss merged commit af46ef8 into main Apr 9, 2026
13 checks passed
@vbreuss
vbreuss deleted the topic/add-periodictimer-callback branch April 9, 2026 20:06
@github-actions

Copy link
Copy Markdown

This is addressed in release v6.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request state: released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants