Added abstraction over DateTime.Now #10

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@damianh
damianh commented Aug 19, 2011

Added abstraction over DateTime.Now. The SystemTime abstraction is primarily used in time sensitive acceptance tests. While NLog isn't a typical test target, it is desirable to generate log messages that match the system under test.

http://ayende.com/blog/3408/dealing-with-time-in-tests
http://codebetter.com/drusellers/2009/01/11/kick-the-datetime-now-addiction/
http://lostechies.com/jimmybogard/2008/11/09/systemtime-versus-isystemclock-dependencies-revisited/
http://seabites.wordpress.com/2011/07/24/how-do-you-control-time/

Example real-world usage: https://github.com/quartznet/quartznet/blob/master/src/Quartz/SystemTime.cs

Hope you accept.

Let me know if there are any problems.

Damian

damianh commented Aug 30, 2011

FWIW, a similar pull request has been accepted into RavenDB and EventStore

damianh commented Feb 2, 2015

I love wasting my time.

@damianh damianh closed this Feb 2, 2015

FWIW, thanks for pointing this out... I find it of value, and will keep this these techniques in mind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment