Table of Contents

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

CollectionOrderedConstraint

Descending

If used performs a reverse comparison

public CollectionOrderedConstraint Descending { get; }

Property Value

CollectionOrderedConstraint

Description

The Description of what this constraint tests, for use in messages and in the ConstraintResult.

public override string Description { get; }

Property Value

string

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

string

Then

Then signals a break between two ordering steps

public CollectionOrderedConstraint Then { get; }

Property Value

CollectionOrderedConstraint

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

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

CollectionOrderedConstraint

GetStringRepresentation()

Returns the string representation of the constraint.

protected override string GetStringRepresentation()

Returns

string

Matches(IEnumerable)

Test whether the collection is ordered

protected override bool Matches(IEnumerable actual)

Parameters

actual IEnumerable

Returns

bool

Using(IComparer)

Modifies the constraint to use an IComparer and returns self.

public CollectionOrderedConstraint Using(IComparer comparer)

Parameters

comparer IComparer

Returns

CollectionOrderedConstraint

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

CollectionOrderedConstraint

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

CollectionOrderedConstraint

Type Parameters

T