0

I have to test a method that checks if the "System.DateTime.Today" corresponds to some provided date. While unit testing this method i came across this problem: How can I change the system time? It must correspond to a date between the 2nd November and 1st January but now we are in July and I need to test the method. Searching on StackOverflow (and generally on Internet) I came across a solution that uses Coredll.dll, which isn't good for me because I'm not using windows CE. There were also a solution with Kernel32.dll but it seems to not work with the SetSystemTime function. Is there a solution to my problems?

I am using Windows 8.1 64 bit system

Igic
  • 45
  • 7
  • 3
    Don't go there. Wrap it with something you control. – Charles Mager Jul 11 '16 at 16:08
  • @CharlesMager the problem is that in the application there is a method that access to `System.DateTime.Today` and I don't have the permission to edit it, so I have to interact directly with the system.. – Igic Jul 12 '16 at 06:22

0 Answers0