Facilitate the control of the course of time in the tests to avoid their fragility
Author: bdovazCreated Apr 1, 2025Updated Mar 30, 2026
Microsoft created in .NET 8 a package with the TimeProvider class.
This class is very useful to be able to mock it and use it together with Task.Delay since it adds an overload with TimeProvider.
Besides, they provide another package to be able to control the course of time in tests.
It would be nice if UniTask had a similar functionality because otherwise, it is difficult to make tests that are not fragile.
Source: Cysharp/UniTask