Skip to content

Add default timeout for time comparisons #49

Open
@vbreuss

Description

@vbreuss

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions