Created
May 19, 2013 05:48
-
-
Save spewu/5606822 to your computer and use it in GitHub Desktop.
A nice small wrapper around DateTime. Makes it possible to override the returned DateTime, which is very handy in unit tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Diagnostics.CodeAnalysis; | |
public class SystemTime | |
{ | |
[SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:FieldsMustBePrivate", Justification = "Reviewed. Suppression is OK here.")] | |
public static Func<DateTime> Now = () => DateTime.Now; | |
[SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:FieldsMustBePrivate", Justification = "Reviewed. Suppression is OK here.")] | |
public static Func<DateTime> UtcNow = () => DateTime.UtcNow; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment