Table of Contents

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

from IComparable

Inclusive beginning of the range. Must be less than or equal to to.

to IComparable

Inclusive 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

string

Methods

ApplyTo<TActual>(TActual)

Test whether the constraint is satisfied by a given value

public override ConstraintResult ApplyTo<TActual>(TActual actual)

Parameters

actual TActual

The 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

comparer IComparer

Returns

RangeConstraint

Using<T>(IComparer<T>)

Modifies the constraint to use an IComparer<T> and returns self.

public RangeConstraint Using<T>(IComparer<T> comparer)

Parameters

comparer IComparer<T>

Returns

RangeConstraint

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

comparer Comparison<T>

Returns

RangeConstraint

Type Parameters

T