posts - 19 , comments - 8 , trackbacks - 0

DateTime

Testing code with time dependency in C#
Introduction Testing code that is date or time dependent is clearly problematic! The first step is to create an interface which we will use instead of accessing the DateTime object itself. The interface using System; namespace JetBlack.Common.Timers { public interface IDateTimeProvider { DateTime Today { get; } DateTime Now { get; } long Ticks { get; } } } A native date time provider We can wrap up the standard date time object with the following code. using System; namespace JetBlack.Common.Timers ......

Posted On Thursday, December 18, 2014 4:55 PM | Comments (0) | Filed Under [ C# DateTime Testing ]

Powered by: