Class EqualTimeBasedConstraintWithTimeSpanTolerance<T>
EqualConstraint is able to compare an actual value with the expected value provided in its constructor. Two objects are considered equal if both are null, or if both have the same value. NUnit has special semantics for some object types.
Inherited Members
Namespace: NUnit.Framework.Constraints
Assembly: nunit.framework.dll
Syntax
public class EqualTimeBasedConstraintWithTimeSpanTolerance<T> : Constraint, IConstraint, IResolveConstraint where T : notnull, IEquatable<T>, IComparable<T>
Type Parameters
| Name | Description |
|---|---|
| T |
Constructors
View SourceEqualTimeBasedConstraintWithTimeSpanTolerance(T, Func<T, long>, TimeSpan)
Initializes a new instance of the EqualConstraint class.
Declaration
public EqualTimeBasedConstraintWithTimeSpanTolerance(T expected, Func<T, long> getTicks, TimeSpan tolerance)
Parameters
| Type | Name | Description |
|---|---|---|
| T | expected | The expected value. |
| Func<T, long> | getTicks | Method to extract the Ticks from an instance of |
| TimeSpan | tolerance | The tolerance to apply when comparing for equality. |
Properties
View SourceDescription
The Description of what this constraint tests, for use in messages and in the ConstraintResult.
Declaration
public override string Description { get; }
Property Value
| Type | Description |
|---|---|
| string |
Overrides
Methods
View SourceApplyTo(T)
Test whether the constraint is satisfied by a given value
Declaration
public ConstraintResult ApplyTo(T actual)
Parameters
| Type | Name | Description |
|---|---|---|
| T | actual | The value to be tested |
Returns
| Type | Description |
|---|---|
| ConstraintResult | True for success, false for failure |
ApplyTo<TActual>(TActual)
Test whether the constraint is satisfied by a given value
Declaration
public override ConstraintResult ApplyTo<TActual>(TActual actual)
Parameters
| Type | Name | Description |
|---|---|---|
| TActual | actual | The value to be tested |
Returns
| Type | Description |
|---|---|
| ConstraintResult | True for success, false for failure |
Type Parameters
| Name | Description |
|---|---|
| TActual |