Skip to content

feat: implement mock DateTimeOffset in testing package#1050

Merged
vbreuss merged 2 commits into
mainfrom
feat/datetimeoffset-mock
Jul 11, 2026
Merged

feat: implement mock DateTimeOffset in testing package#1050
vbreuss merged 2 commits into
mainfrom
feat/datetimeoffset-mock

Conversation

@vbreuss

@vbreuss vbreuss commented Jul 11, 2026

Copy link
Copy Markdown
Member

Adds the mock implementation of IDateTimeOffset to MockTimeSystem, replacing the temporary stub from the TimeZoneInfo mock change.

  • Implement DateTimeOffsetMock and expose it via MockTimeSystem.DateTimeOffset; it shares the same underlying ITimeProvider clock as IDateTime.
  • Now derives its offset from the configured local time zone (ITimeProvider.LocalTimeZone) so it is deterministic and DST-aware, while UtcNow uses a zero offset and the value constants mirror ITimeProvider.
  • Add a DateTimeOffsetRead notification callback for parity with DateTimeRead.
  • Share the runtime-agnostic IDateTimeOffset tests (incl. a Now/UtcNow round-trip invariant) so they run against the real and mock implementation.
  • Document DateTimeOffset in the time-system docs.

@vbreuss vbreuss self-assigned this Jul 11, 2026
@vbreuss vbreuss added the enhancement New feature or request label Jul 11, 2026
@github-actions

github-actions Bot commented Jul 11, 2026

Copy link
Copy Markdown

Test Results

    102 files  ±  0      102 suites  ±0   2h 27m 25s ⏱️ - 2m 12s
112 650 tests + 18  100 040 ✅ + 18  12 610 💤 ±0  0 ❌ ±0 
270 302 runs  +360  233 574 ✅ +360  36 728 💤 ±0  0 ❌ ±0 

Results for commit 747ef8f. ± Comparison against base commit ac3d576.

This pull request removes 109734 and adds 109751 tests. Note that renamed tests count towards both.
  )
)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(0bc5f982-ef05-4fb2-88b1-a5ece06d8601)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(0e482612-afd4-47fb-b427-7784f64bf595)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(11af0a2f-0270-4f21-8346-878aa5a3731e)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(1c38991c-e2be-474c-bc2e-3f4ef6985173)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(2fb40167-c4c9-42b6-b1bc-80717a7316a3)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(3627a438-1b1b-4318-b597-b14b3398e42e)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(3b17498a-0ced-4d8a-8fe6-e01057692475)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(4075744e-ed53-4c76-887d-80164b019cc6)
…
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(05809312-3fc2-4825-b355-904f8d0d1738)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(086ce362-0740-48b7-af8a-cd002ea53250)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(23d78da6-c6e3-4046-bec5-a2d8b0f7284f)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(263a6cb7-ac01-443c-9b25-2bcedc4de7bf)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(3bd2c19b-76fb-40a7-aad7-666a5b3f9c9d)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(3ff7c346-7661-48ff-bd7a-466abf836d1e)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(400aa81f-ddc0-45fa-a91d-3b7b9f8c2d91)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(468b47ac-2196-4bc9-a20c-51a307a974a5)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(4b7b140f-fb08-44a8-80d5-52ec0c6914be)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(574d535b-9f1a-4aa5-887e-9724763a17bd)
…
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(0bc5f982-ef05-4fb2-88b1-a5ece06d8601)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(0e482612-afd4-47fb-b427-7784f64bf595)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(11af0a2f-0270-4f21-8346-878aa5a3731e)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(1c38991c-e2be-474c-bc2e-3f4ef6985173)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(2fb40167-c4c9-42b6-b1bc-80717a7316a3)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(3627a438-1b1b-4318-b597-b14b3398e42e)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(3b17498a-0ced-4d8a-8fe6-e01057692475)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(4075744e-ed53-4c76-887d-80164b019cc6)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(40b4f9ae-cc76-41ba-b4fc-dc889207699b)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(4c6ed436-3978-48bd-bb59-c8a2217b3e2a)
…
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(05809312-3fc2-4825-b355-904f8d0d1738)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(086ce362-0740-48b7-af8a-cd002ea53250)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(23d78da6-c6e3-4046-bec5-a2d8b0f7284f)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(263a6cb7-ac01-443c-9b25-2bcedc4de7bf)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(3bd2c19b-76fb-40a7-aad7-666a5b3f9c9d)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(3ff7c346-7661-48ff-bd7a-466abf836d1e)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(400aa81f-ddc0-45fa-a91d-3b7b9f8c2d91)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(468b47ac-2196-4bc9-a20c-51a307a974a5)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(4b7b140f-fb08-44a8-80d5-52ec0c6914be)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(574d535b-9f1a-4aa5-887e-9724763a17bd)
…

♻️ This comment has been updated with latest results.

Adds the mock implementation of `IDateTimeOffset` to `MockTimeSystem`,
replacing the temporary stub from the `TimeZoneInfo` mock change.

- Implement `DateTimeOffsetMock` and expose it via `MockTimeSystem.DateTimeOffset`;
  it shares the same underlying `ITimeProvider` clock as `IDateTime`.
- `Now` derives its offset from the configured local time zone
  (`ITimeProvider.LocalTimeZone`) so it is deterministic and DST-aware, while
  `UtcNow` uses a zero offset and the value constants mirror `ITimeProvider`.
- Add a `DateTimeOffsetRead` notification callback for parity with
  `DateTimeRead`.
- Share the runtime-agnostic `IDateTimeOffset` tests (incl. a Now/UtcNow
  round-trip invariant) so they run against the real and mock implementation.
- Document `DateTimeOffset` in the time-system docs.
@vbreuss vbreuss force-pushed the feat/datetimeoffset-mock branch from e637104 to 747ef8f Compare July 11, 2026 09:08
@vbreuss vbreuss force-pushed the feat/datetimeoffset-mock branch from 747ef8f to 74dd6db Compare July 11, 2026 10:04
@vbreuss vbreuss merged commit 5c9922e into main Jul 11, 2026
8 of 10 checks passed
@vbreuss vbreuss deleted the feat/datetimeoffset-mock branch July 11, 2026 10:04
@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

This is addressed in release v7.0.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.

1 participant