Table of Contents

Class DelayedConstraint

Namespace
NUnit.Framework.Constraints
Assembly
nunit.framework.dll

Applies a delay to the match so that a match can be evaluated in the future.

public class DelayedConstraint : PrefixConstraint, IConstraint, IResolveConstraint
Inheritance
DelayedConstraint
Implements
Derived
Inherited Members

Constructors

DelayedConstraint(IConstraint, int)

Creates a new DelayedConstraint

public DelayedConstraint(IConstraint baseConstraint, int delayInMilliseconds)

Parameters

baseConstraint IConstraint

The inner constraint to decorate

delayInMilliseconds int

The time interval after which the match is performed

Exceptions

InvalidOperationException

If the value of delayInMilliseconds is less than 0

DelayedConstraint(IConstraint, int, int)

Creates a new DelayedConstraint

public DelayedConstraint(IConstraint baseConstraint, int delayInMilliseconds, int pollingIntervalInMilliseconds)

Parameters

baseConstraint IConstraint

The inner constraint to decorate

delayInMilliseconds int

The time interval after which the match is performed, in milliseconds

pollingIntervalInMilliseconds int

The time interval used for polling, in milliseconds

Exceptions

InvalidOperationException

If the value of delayInMilliseconds is less than 0

Properties

DelayInterval

Delay value store as an Interval object

protected Interval DelayInterval { get; set; }

Property Value

Interval

Description

Gets text describing a constraint

public override string Description { get; }

Property Value

string

PollingInterval

Polling value stored as an Interval object

protected Interval PollingInterval { get; set; }

Property Value

Interval

Methods

ApplyTo<TActual>(ActualValueDelegate<TActual>)

Test whether the constraint is satisfied by a delegate

public override ConstraintResult ApplyTo<TActual>(ActualValueDelegate<TActual> del)

Parameters

del ActualValueDelegate<TActual>

The delegate whose value is to be tested

Returns

ConstraintResult

A ConstraintResult

Type Parameters

TActual

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 if the base constraint fails, false if it succeeds

Type Parameters

TActual

ApplyTo<TActual>(ref TActual)

Test whether the constraint is satisfied by a given reference. Overridden to wait for the specified delay period before calling the base constraint with the dereferenced value.

public override ConstraintResult ApplyTo<TActual>(ref TActual actual)

Parameters

actual TActual

A reference to the value to be tested

Returns

ConstraintResult

True for success, false for failure

Type Parameters

TActual

GetStringRepresentation()

Returns the string representation of the constraint.

protected override string GetStringRepresentation()

Returns

string