Open
Description
Add a default timeout for time comparisons that can be set via customizations, e.g.
IDisposable Customization.Settings.SetDefaultTimeTolerance(TimeSpan tolerance)
This should set a default tolerance that is automatically applied to all tests (and also displayed in the test expectation). When the disposable gets disposed, the default tolerance is reset to zero.
Consider also enabling this as an AsyncLocal
setting, so that this can be a per-class change.
Motivation:
In Windows the DateTime
resolution is about 10 to 15 milliseconds, so comparing them as exact values results in brittle tests which could be improved by applying a corresponding default tolerance, when the tests you are doing don't require exact values.