👩💻 Join our community of thousands of amazing developers!
Bending DateTime in .NET to Test Your Code BetterMocking DateTime in .NET is painful, here’s a way to make it hurt lessOkay I’ll dial down the hyperbole, over my too many years (read I’m feeling old) as an engineer I have run into a problem where my code has contained a DateTime.Now or DateTime.UtcNow. When I write a test, I can't validate the actual time because milliseconds have passed from when the code ran and then my test goes to validate. It's not a huge problem but annoying as I like to v...