Fakes has a built in support for this; in fact there are two ways to achieve this.
1) Use ShimsContext.ExecuteWithoutShims() as a wrapper for the code you don't need shim behavior:
System.Fakes.ShimDateTime.NowGet = () =>
{
return ShimsContext.ExecuteWithoutShims(() => DateTime.Now.AddDays(-1));
};
2) Another approach is to set the shim to null, call the original method and restore the shim.
FakesDelegates.Func<DateTime> shim = null;
shim = () =>
{
System.Fakes.ShimDateTime.NowGet = null;
var value = ShimsContext.ExecuteWithoutShims(() => DateTime.Now.AddDays(-1));
System.Fakes.ShimDateTime.NowGet = shim;
return value;
};
System.Fakes.ShimDateTime.NowGet = shim;
Edit: Obviously the first approach is more concise and readable. SO I prefer it over explicitly declaring shim variable and removing/restoring the shim.