Class CollectionOrderedConstraint
- Namespace
- NUnit.Framework.Constraints
- Assembly
- nunit.framework.dll
CollectionOrderedConstraint is used to test whether a collection is ordered.
public class CollectionOrderedConstraint : CollectionConstraint, IConstraint, IResolveConstraint
- Inheritance
-
CollectionOrderedConstraint
- Implements
- Inherited Members
Constructors
CollectionOrderedConstraint()
Construct a CollectionOrderedConstraint
public CollectionOrderedConstraint()
Properties
Ascending
If used performs a default ascending comparison
public CollectionOrderedConstraint Ascending { get; }
Property Value
Descending
If used performs a reverse comparison
public CollectionOrderedConstraint Descending { get; }
Property Value
Description
The Description of what this constraint tests, for use in messages and in the ConstraintResult.
public override string Description { get; }
Property Value
DisplayName
The display name of this Constraint for use by ToString(). The default value is the name of the constraint with trailing "Constraint" removed. Derived classes may set this to another name in their constructors.
public override string DisplayName { get; }
Property Value
Then
Then signals a break between two ordering steps
public CollectionOrderedConstraint Then { 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
actual
TActualThe value to be tested
Returns
- ConstraintResult
True for success, false for failure
Type Parameters
TActual
By(string)
Modifies the constraint to test ordering by the value of a specified property and returns self.
public CollectionOrderedConstraint By(string propertyName)
Parameters
propertyName
string
Returns
GetStringRepresentation()
Returns the string representation of the constraint.
protected override string GetStringRepresentation()
Returns
Matches(IEnumerable)
Test whether the collection is ordered
protected override bool Matches(IEnumerable actual)
Parameters
actual
IEnumerable
Returns
Using(IComparer)
Modifies the constraint to use an IComparer and returns self.
public CollectionOrderedConstraint Using(IComparer comparer)
Parameters
comparer
IComparer
Returns
Using<T>(IComparer<T>)
Modifies the constraint to use an IComparer<T> and returns self.
public CollectionOrderedConstraint Using<T>(IComparer<T> comparer)
Parameters
comparer
IComparer<T>
Returns
Type Parameters
T
Using<T>(Comparison<T>)
Modifies the constraint to use a Comparison<T> and returns self.
public CollectionOrderedConstraint Using<T>(Comparison<T> comparer)
Parameters
comparer
Comparison<T>
Returns
Type Parameters
T