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.
TimePlugincurrently callsDateTimeOffset.Nowdirectly in all methods, making unit tests depend on the real clock. The test file already has a// TODO: allow clock injection and test all functionscomment acknowledging this gap.Proposed fix: accept a
TimeProviderconstructor parameter (defaulting toTimeProvider.System), which is the standard .NET pattern for clock abstraction since .NET 8.I have an implementation ready and will submit a PR shortly.