Table of Contents

Class Tolerance

Namespace
NUnit.Framework.Constraints
Assembly
nunit.framework.dll

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 class Tolerance
Inheritance
Tolerance
Inherited Members

Constructors

Tolerance(object)

Constructs a linear tolerance of a specified amount

public Tolerance(object amount)

Parameters

amount object

Properties

Days

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

public Tolerance Days { get; }

Property Value

Tolerance

Default

Returns a default Tolerance object, equivalent to specifying an exact match unless DefaultFloatingPointTolerance is set, in which case, the DefaultFloatingPointTolerance will be used.

public static Tolerance Default { get; }

Property Value

Tolerance

Exact

Returns an empty Tolerance object, equivalent to specifying an exact match even if DefaultFloatingPointTolerance is set.

public static Tolerance Exact { get; }

Property Value

Tolerance

Hours

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

public Tolerance Hours { get; }

Property Value

Tolerance

IsUnsetOrDefault

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

public bool IsUnsetOrDefault { get; }

Property Value

bool

Milliseconds

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

public Tolerance Milliseconds { get; }

Property Value

Tolerance

Minutes

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

public Tolerance Minutes { get; }

Property Value

Tolerance

Mode

Gets the ToleranceMode for the current Tolerance

public ToleranceMode Mode { get; }

Property Value

ToleranceMode

Percent

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

public Tolerance Percent { get; }

Property Value

Tolerance

Seconds

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

public Tolerance Seconds { get; }

Property Value

Tolerance

Ticks

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

public Tolerance Ticks { get; }

Property Value

Tolerance

Ulps

Returns a new tolerance, using the current amount in Ulps

public Tolerance Ulps { get; }

Property Value

Tolerance

Value

Gets the value of the current Tolerance instance.

public object Value { get; }

Property Value

object