Timeprovider

Guidance for TimeProvider abstraction for testable time-dependent code. USE FOR: making time-dependent code testable, replacing DateTime.UtcNow and DateTimeOffset.UtcNow with injectable abstractions, controlling time in unit tests with FakeTimeProvider, testing expiration logic, scheduling, token lifetimes, and time-based business rules. DO NOT USE FOR: high-precision timing or benchmarking (use Stopwatch), NTP synchronization, or scenarios running on .NET versions prior to .NET 8.

Tyler-R-Kendrick 907f542 16 files · 34.2 KB Updated

File contents

Tyler-R-Kendrick/agent-skills/tree/main/skills/dotnet/testing/timeprovider commit 907f54205d

Frequently asked questions

npx skillmds add tyler-r-kendrick/timeprovider