The following is an example of a MockDateTimeService in C#. The MockDateTimeService allows you to set the DateTime to be returned by the service in order to reliably test how other parts of the system might behave based on specific DateTime.
class MockDateTimeService
{
public DateTime CurrentDateTime { get; set; } = new DateTime();
public DateTime UTCNow()
{
return CurrentDateTime.ToUniversalTime();
}
}