Skip to content

Instantly share code, notes, and snippets.

@DaveHogan
DaveHogan / DateTimeExtensions.cs
Last active December 22, 2015 00:39
Replacing DateTime.Now method to assist with time sensitive unit tests
// Following on from: http://stackoverflow.com/q/7661953/235644
//
// Observations:
// Should consider using UTC for better globalization support
//
// Usage:
DateTimeExtensions.SetNowFunction(() => date1);
/// <summary>
/// Allow custom generation of Now times.