Fody
This is an add-in forIonad replaces static types with your own.
The nuget package
https://nuget.org/packages/Ionad.Fody/
PM> Install-Package Ionad.Fody
Your Code
[StaticReplacement(typeof(DateTime))]
public static class DateTimeSubstitute
{
public static IDateTime Current { get; set; }
public static DateTime Now { get { return Current.Now; } }
}
public void SomeMethod()
{
var time = DateTime.Now;
// ...
}
What gets compiled
public void SomeMethod()
{
var time = DateTimeSubstitute.Now;
// ...
}
Contributors
Icon
Interchange designed by Laurent Patain from The Noun Project