Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个在某些条件下返回 DateTime.now() 的函数。我想测试该功能,但如果我针对 DateTime.now() 对其进行测试,它将创建一个不稳定的测试。有什么方法可以冻结执行此特定测试的时间然后重置它?