Tolerance Class

Summary

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.
Namespace
TCLite.Constraints
Base Types
  • object
graph BT Type-->Base0["object"] Type["Tolerance"] class Type type-node

Syntax

public class Tolerance

Constructors

Name Summary
Tolerance(object) Constructs a linear tolerance of a specified amount

Properties

Name Value Summary
Amount object
Gets the magnitude of the current Tolerance instance.
Days Tolerance
Returns a new tolerance with a TimeSpan as the amount, using the current amount as a number of days.
Default Tolerance
Returns an empty Tolerance object, equivalent to specifying no tolerance. In most cases, it results in an exact match but for floats and doubles a default tolerance may be used.
static
Exact Tolerance
Returns a default Tolerance object, equivalent to an exact match.
static
Hours Tolerance
Returns a new tolerance with a TimeSpan as the amount, using the current amount as a number of hours.
IsDefault bool
Returns true if the current tolerance is empty.
Milliseconds Tolerance
Returns a new tolerance with a TimeSpan as the amount, using the current amount as a number of milliseconds.
Minutes Tolerance
Returns a new tolerance with a TimeSpan as the amount, using the current amount as a number of minutes.
Mode ToleranceMode
the ToleranceMode for the current Tolerance
Percent Tolerance
Returns a new tolerance, using the current amount as a percentage.
Seconds Tolerance
Returns a new tolerance with a TimeSpan as the amount, using the current amount as a number of seconds.
Ticks Tolerance
Returns a new tolerance with a TimeSpan as the amount, using the current amount as a number of clock ticks.
Ulps Tolerance
Returns a new tolerance, using the current amount in Ulps.