Four Ways to Fake Time

Are your unit tests failing because the code-under-test is coupled to the system clock? In other words, does the method you are testing use the System.DateTime.Now property, and that dependency is making it hard to properly unit test the code?

Calendar

This series of posts presents four ways to fake time as a means of improving testability. Specifically, we'll look at these four techniques:

The Optional 'clock' ParameterBrute Force Property InjectionInject The IClock InterfaceMock Isolation FrameworkTim...
 •  0 comments  •  flag
Share on Twitter
Published on January 26, 2012 07:11
No comments have been added yet.