C# - A good library to fake Time.Now?

Posted by Amokrane on Stack Overflow See other posts from Stack Overflow or by Amokrane
Published on 2010-04-23T08:12:43Z Indexed on 2010/04/23 8:23 UTC
Read the original article Hit count: 209

Filed under:
|
|

Hi,

In order to Unit-Test a feature, I need to fake DateTime.Now. Something like:

SupposeNowIs(new DateTime(..));

I can either use a third library that does it, or write my own little class. What do you recommand? Do you know any good library for this purpose? How would you fake time in C#? By changing DateTime.Now? (I suppose it's read only?).

Thank you!

© Stack Overflow or respective owner

Related posts about c#

Related posts about fake-data