Class RangeConstraint
- Namespace
- NUnit.Framework.Constraints
- Assembly
- nunit.framework.dll
RangeConstraint tests whethe two _values are within a specified range.
public class RangeConstraint : Constraint, IConstraint, IResolveConstraint
- Inheritance
-
RangeConstraint
- Implements
- Inherited Members
Constructors
RangeConstraint(IComparable, IComparable)
Initializes a new instance of the RangeConstraint class.
public RangeConstraint(IComparable from, IComparable to)
Parameters
fromIComparableInclusive beginning of the range. Must be less than or equal to to.
toIComparableInclusive end of the range. Must be greater than or equal to from.
Remarks
from must be less than or equal to true
Properties
Description
Gets text describing a constraint
public override string Description { get; }
Property Value
Methods
ApplyTo<TActual>(TActual)
Test whether the constraint is satisfied by a given value
public override ConstraintResult ApplyTo<TActual>(TActual actual)
Parameters
actualTActualThe value to be tested
Returns
- ConstraintResult
True for success, false for failure
Type Parameters
TActual
Using(IComparer)
Modifies the constraint to use an IComparer and returns self.
public RangeConstraint Using(IComparer comparer)
Parameters
comparerIComparer
Returns
Using<T>(IComparer<T>)
Modifies the constraint to use an IComparer<T> and returns self.
public RangeConstraint Using<T>(IComparer<T> comparer)
Parameters
comparerIComparer<T>
Returns
Type Parameters
T
Using<T>(Comparison<T>)
Modifies the constraint to use a Comparison<T> and returns self.
public RangeConstraint Using<T>(Comparison<T> comparer)
Parameters
comparerComparison<T>
Returns
Type Parameters
T