Skip to content

.Net: [.NET] TimePlugin: add TimeProvider injection for testability #14111

Closed

Description

TimePlugin currently calls DateTimeOffset.Now directly in all methods, making unit tests depend on the real clock. The test file already has a // TODO: allow clock injection and test all functions comment acknowledging this gap.

Proposed fix: accept a TimeProvider constructor parameter (defaulting to TimeProvider.System), which is the standard .NET pattern for clock abstraction since .NET 8.

I have an implementation ready and will submit a PR shortly.

Activity

  1. changed the title [-][.NET] TimePlugin: add TimeProvider injection for testability[/-] [+].Net: [.NET] TimePlugin: add TimeProvider injection for testability[/+] on Jun 23, 2026
  2. added a commit that references this issue on Jul 22, 2026
    acb3e35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETIssue or Pull requests regarding .NET codetriage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions