feat: implement mock PeriodicTimer in testing package#965
Conversation
There was a problem hiding this comment.
Pull request overview
Adds PeriodicTimer support to the ITimeSystem abstraction by introducing a mock implementation in Testably.Abstractions.Testing, plus tests and API-surface updates to validate/lock in the new contract.
Changes:
- Implement
PeriodicTimerMock+PeriodicTimerFactoryMockand expose them viaMockTimeSystem.PeriodicTimer(feature-flagged). - Add test coverage for
PeriodicTimerfactory and timer behavior underTimeSystemTests. - Update API expectation files and add the
aweXpect.Chronologytest dependency; adjust build/package config.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/Testably.Abstractions.Tests/TimeSystem/PeriodicTimerTests.cs | Adds behavior tests for IPeriodicTimer across time systems. |
| Tests/Testably.Abstractions.Tests/TimeSystem/PeriodicTimerFactoryTests.cs | Adds validation + period propagation tests for the factory. |
| Tests/Testably.Abstractions.Testing.Tests/TimeSystem/PeriodicTimerFactoryMockTests.cs | Ensures wrapping an existing PeriodicTimer is rejected in MockTimeSystem. |
| Tests/Directory.Build.props | Adds aweXpect.Chronology reference for duration extensions in tests. |
| Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Testing_net8.0.txt | Updates expected API surface (MockTimeSystem.PeriodicTimer). |
| Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Testing_net9.0.txt | Updates expected API surface (MockTimeSystem.PeriodicTimer). |
| Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Testing_net10.0.txt | Updates expected API surface (MockTimeSystem.PeriodicTimer). |
| Source/Testably.Abstractions.Testing/TimeSystem/PeriodicTimerMock.cs | Implements mock IPeriodicTimer behavior. |
| Source/Testably.Abstractions.Testing/TimeSystem/PeriodicTimerFactoryMock.cs | Implements mock IPeriodicTimerFactory for MockTimeSystem. |
| Source/Testably.Abstractions.Testing/MockTimeSystem.cs | Wires PeriodicTimer factory into MockTimeSystem behind feature flag. |
| Source/Testably.Abstractions.Testing/Helpers/ExceptionFactory.cs | Adds NotSupportedPeriodicTimerWrapping and minor formatting changes. |
| README.md | Documents PeriodicTimer as a supported abstraction. |
| Pipeline/Build.cs | Resets build scope to default. |
| Directory.Packages.props | Adds aweXpect.Chronology version + bumps internal package versions. |
Source/Testably.Abstractions.Testing/TimeSystem/PeriodicTimerMock.cs
Outdated
Show resolved
Hide resolved
Test Results 102 files + 101 102 suites +101 3h 4m 3s ⏱️ + 3h 4m 1s Results for commit f1804f6. ± Comparison against base commit fd3a7ab. ♻️ This comment has been updated with latest results. |
|
|
This is addressed in release v6.0.0. |



Adds
PeriodicTimersupport to theITimeSystemabstraction by introducing a mock implementation inTestably.Abstractions.Testing, plus tests and API-surface updates to validate/lock in the new contract.Key Changes:
PeriodicTimerMock+PeriodicTimerFactoryMockand expose them viaMockTimeSystem.PeriodicTimer(feature-flagged).PeriodicTimerfactory and timer behavior underTimeSystemTests.aweXpect.Chronologytest dependency; adjust build/package config.--
PeriodicTimerinITimeSystem#960