Refactoring Static System Clock Access

added by DotNetKicks
8/10/2016 12:59:20 PM

2 Kicks, 561 Views

If you have logic that depends on dates and/or times, it can be difficult to test if it's directly accessing the system clock (via DateTime.Now in .NET, for example). This is an example of an insidious dependency that can add unnecessary coupling to an application, making it harder to maintain.