<PackageReference Include="NUnit" Version="4.2.2" />

Tolerance

public sealed class Tolerance
The Tolerance class generalizes the notion of a tolerance within which an equality test succeeds. Normally, it is used with numeric types, but it can be used with any type that supports taking a difference between two objects and comparing that difference to a value.
public struct Range

Tolerance.Range represents the range of values that match a specific tolerance, when applied to a specific value.

public static readonly Tolerance Default

Returns a default Tolerance object, equivalent to a default matching rules.

public static readonly Tolerance Exact

Returns an empty Tolerance object, equivalent to an exact match.

public object Amount { get; }

Gets the magnitude of the current Tolerance instance.

public Tolerance Days { get; }

Returns a new tolerance with a TimeSpan as the amount, using the current amount as a number of days.

public bool HasVariance { get; }

Returns true if the current tolerance varies from exact and default. Indicating tolerance needs processing.

public Tolerance Hours { get; }

Returns a new tolerance with a TimeSpan as the amount, using the current amount as a number of hours.

public bool IsUnsetOrDefault { get; }

Returns true if the current tolerance has not been set or is using the default.

public Tolerance Milliseconds { get; }

Returns a new tolerance with a TimeSpan as the amount, using the current amount as a number of milliseconds.

public Tolerance Minutes { get; }

Returns a new tolerance with a TimeSpan as the amount, using the current amount as a number of minutes.

public ToleranceMode Mode { get; }

Gets the ToleranceMode for the current Tolerance

public Tolerance Percent { get; }

Returns a new tolerance, using the current amount as a percentage.

public Tolerance Seconds { get; }

Returns a new tolerance with a TimeSpan as the amount, using the current amount as a number of seconds.

public Tolerance Ticks { get; }

Returns a new tolerance with a TimeSpan as the amount, using the current amount as a number of clock ticks.

public Tolerance Ulps { get; }

Returns a new tolerance, using the current amount in Ulps

public Tolerance(object amount)

Constructs a linear tolerance of a specified amount

public Range ApplyToValue(object value)

Apply the tolerance to an expected value and return a Tolerance.Range that represents the acceptable values.