Skip to content

fix: GetTimestamp in mocked stopwatch should correlate to frequency#973

Merged
vbreuss merged 3 commits intomainfrom
topic/fix-gettimestamp-in-stopwatch
Mar 17, 2026
Merged

fix: GetTimestamp in mocked stopwatch should correlate to frequency#973
vbreuss merged 3 commits intomainfrom
topic/fix-gettimestamp-in-stopwatch

Conversation

@vbreuss
Copy link
Member

@vbreuss vbreuss commented Mar 17, 2026

This PR fixes the mocked IStopwatchFactory.GetTimestamp() implementation so that timestamp deltas align with the factory’s reported Frequency (i.e., (t2 - t1) / Frequency yields elapsed seconds), and adds a regression test to validate that behavior.

Key Changes:

  • Update StopwatchFactoryMock.GetTimestamp() to scale the returned timestamp by _tickPeriod so it correlates with Frequency.
  • Add a new test asserting (timestampDelta / Frequency) ≈ 1 second after a TimeSystem.Task.Delay.

@vbreuss vbreuss self-assigned this Mar 17, 2026
@vbreuss vbreuss added the bug Something isn't working label Mar 17, 2026
Copilot AI review requested due to automatic review settings March 17, 2026 09:29
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 PR fixes the mocked IStopwatchFactory.GetTimestamp() implementation so that timestamp deltas align with the factory’s reported Frequency (i.e., (t2 - t1) / Frequency yields elapsed seconds), and adds a regression test to validate that behavior.

Changes:

  • Update StopwatchFactoryMock.GetTimestamp() to scale the returned timestamp by _tickPeriod so it correlates with Frequency.
  • Add a new test asserting (timestampDelta / Frequency) ≈ 1 second after a TimeSystem.Task.Delay.

Reviewed changes

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

File Description
Tests/Testably.Abstractions.Tests/TimeSystem/StopwatchFactoryTests.cs Adds a regression test that validates timestamp/frequency correlation using a 1-second delay.
Source/Testably.Abstractions.Testing/TimeSystem/StopwatchFactoryMock.cs Changes mocked stopwatch timestamp units to match the configured frequency scaling.

@github-actions
Copy link

github-actions bot commented Mar 17, 2026

Test Results

    102 files  ± 0      102 suites  ±0   2h 24m 1s ⏱️ -1s
112 459 tests + 3   99 856 ✅ + 3  12 603 💤 ± 0  0 ❌ ±0 
268 022 runs  +40  231 474 ✅ +20  36 548 💤 +20  0 ❌ ±0 

Results for commit 22d5cfb. ± Comparison against base commit 8b1629f.

This pull request removes 109661 and adds 109663 tests. Note that renamed tests count towards both.
  )
)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(040cf223-ebc1-4c6a-85bf-89391072957f)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(1a2a9bbf-011f-47f1-8f16-f2cb29714be7)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(1e75d5e8-5667-463e-a552-94c5ed9a820d)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(278c8e95-cdbb-425b-b83a-0bd378ba991c)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(34185e20-91b6-447b-9ea9-91429a2c567e)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(4366aeb9-d618-4fcc-9a73-cf383bbe9f83)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(478f07f5-2495-4a1c-b702-0da49f26a04b)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(4cc05062-61e0-4f68-aecb-db8f3e932281)
…
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(00e7ebf4-9615-4c7d-ad26-177dbf75c4b2)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(01c910e3-f6f8-4a26-ab69-aa882b8e8f2c)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(0ea2ca53-62e3-4474-ba2d-5945d2d752ea)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(11d7b6ea-50a3-4dbf-98a3-9bd5de6cb922)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(14411bfa-4ac7-41d8-9a4a-39a7af758947)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(1692591d-51a5-47ec-9ebf-0e1d79fe6f51)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(2614689b-8dfc-4b72-8ecb-15a146c68a64)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(2a6b4690-798d-4d9f-b3b5-1e8e494b0ea3)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(33511a6c-fb8f-4b6f-bd35-0a790eaba2f0)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(495e6d67-14d5-42ab-9f07-305b13a1d980)
…
This pull request removes 12552 skipped tests and adds 12552 skipped tests. Note that renamed tests count towards both.
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(040cf223-ebc1-4c6a-85bf-89391072957f)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(1a2a9bbf-011f-47f1-8f16-f2cb29714be7)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(1e75d5e8-5667-463e-a552-94c5ed9a820d)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(278c8e95-cdbb-425b-b83a-0bd378ba991c)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(34185e20-91b6-447b-9ea9-91429a2c567e)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(4366aeb9-d618-4fcc-9a73-cf383bbe9f83)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(478f07f5-2495-4a1c-b702-0da49f26a04b)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(4cc05062-61e0-4f68-aecb-db8f3e932281)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(61f18c58-1f5d-4a4e-95e8-73d82c2db4a4)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(63a4322a-c775-4756-abab-6e6ba6fda4f4)
…
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(00e7ebf4-9615-4c7d-ad26-177dbf75c4b2)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(01c910e3-f6f8-4a26-ab69-aa882b8e8f2c)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(0ea2ca53-62e3-4474-ba2d-5945d2d752ea)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(11d7b6ea-50a3-4dbf-98a3-9bd5de6cb922)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(14411bfa-4ac7-41d8-9a4a-39a7af758947)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(1692591d-51a5-47ec-9ebf-0e1d79fe6f51)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(2614689b-8dfc-4b72-8ecb-15a146c68a64)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(2a6b4690-798d-4d9f-b3b5-1e8e494b0ea3)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(33511a6c-fb8f-4b6f-bd35-0a790eaba2f0)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(495e6d67-14d5-42ab-9f07-305b13a1d980)
…

♻️ This comment has been updated with latest results.

@sonarqubecloud
Copy link

@vbreuss vbreuss merged commit f1b172d into main Mar 17, 2026
14 checks passed
@vbreuss vbreuss deleted the topic/fix-gettimestamp-in-stopwatch branch March 17, 2026 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants