IGLib  1.7.2
The IGLib base library EXTENDED - with other lilbraries and applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
NUnit.Framework.Constraints.Constraint Class Referenceabstract

The Constraint class is the base of all built-in constraints within NUnit. It provides the operator overloads used to combine constraints. More...

+ Inheritance diagram for NUnit.Framework.Constraints.Constraint:
+ Collaboration diagram for NUnit.Framework.Constraints.Constraint:

Public Member Functions

abstract ConstraintResult ApplyTo< TActual > (TActual actual)
 Applies the constraint to an actual value, returning a ConstraintResult. More...
 
virtual ConstraintResult ApplyTo< TActual > (ActualValueDelegate< TActual > del)
 Applies the constraint to an ActualValueDelegate that returns the value to be tested. The default implementation simply evaluates the delegate but derived classes may override it to provide for delayed processing. More...
 
virtual ConstraintResult ApplyTo< TActual > (ref TActual actual)
 Test whether the constraint is satisfied by a given reference. The default implementation simply dereferences the value but derived classes may override it to provide for delayed processing. More...
 
override string ToString ()
 Default override of ToString returns the constraint DisplayName followed by any arguments within angle brackets. More...
 
DelayedConstraint After (int delayInMilliseconds)
 Returns a DelayedConstraint with the specified delay time. More...
 
DelayedConstraint After (int delayInMilliseconds, int pollingInterval)
 Returns a DelayedConstraint with the specified delay time and polling interval. More...
 

Static Public Member Functions

static Constraint operator& (Constraint left, Constraint right)
 This operator creates a constraint that is satisfied only if both argument constraints are satisfied. More...
 
static Constraint operator| (Constraint left, Constraint right)
 This operator creates a constraint that is satisfied if either of the argument constraints is satisfied. More...
 
static Constraint operator! (Constraint constraint)
 This operator creates a constraint that is satisfied if the argument constraint is not satisfied. More...
 

Protected Member Functions

 Constraint (params object[] args)
 Construct a constraint with optional arguments More...
 
virtual string GetStringRepresentation ()
 Returns the string representation of this constraint More...
 

Properties

string DisplayName [get, protected set]
 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. More...
 
virtual string Description [get, protected set]
 The Description of what this constraint tests, for use in messages and in the ConstraintResult. More...
 
object[] Arguments [get, private set]
 Arguments provided to this Constraint, for use in formatting the description. More...
 
ConstraintBuilder Builder [get, set]
 The ConstraintBuilder holding this constraint More...
 
ConstraintExpression And [get]
 Returns a ConstraintExpression by appending And to the current constraint. More...
 
ConstraintExpression With [get]
 Returns a ConstraintExpression by appending And to the current constraint. More...
 
ConstraintExpression Or [get]
 Returns a ConstraintExpression by appending Or to the current constraint. More...
 
- Properties inherited from NUnit.Framework.Constraints.IConstraint
string DisplayName [get]
 The display name of this Constraint for use by ToString(). More...
 
string Description [get]
 The Description of what this constraint tests, for use in messages and in the ConstraintResult. More...
 
object[] Arguments [get]
 Arguments provided to this Constraint, for use in formatting the description. More...
 
ConstraintBuilder Builder [get, set]
 The ConstraintBuilder holding this constraint More...
 

Private Member Functions

IConstraint IResolveConstraint. Resolve ()
 Resolves any pending operators and returns the resolved constraint. More...
 

Static Private Member Functions

static string _displayable (object o)
 

Detailed Description

The Constraint class is the base of all built-in constraints within NUnit. It provides the operator overloads used to combine constraints.

Constructor & Destructor Documentation

NUnit.Framework.Constraints.Constraint.Constraint ( params object[]  args)
inlineprotected

Construct a constraint with optional arguments

Parameters
argsArguments to be saved

Member Function Documentation

abstract ConstraintResult NUnit.Framework.Constraints.Constraint.ApplyTo< TActual > ( TActual  actual)
pure virtual

Applies the constraint to an actual value, returning a ConstraintResult.

Parameters
actualThe value to be tested
Returns
A ConstraintResult

Implements NUnit.Framework.Constraints.IConstraint.

Implemented in NUnit.Framework.Constraints.EqualConstraint, NUnit.Framework.Constraints.FileOrDirectoryExistsConstraint, NUnit.Framework.Constraints.StringConstraint, NUnit.Framework.Constraints.ComparisonConstraint, NUnit.Framework.Constraints.DelayedConstraint, NUnit.Framework.Syntax.ArbitraryConstraintMatching.CustomConstraint, NUnit.Framework.Constraints.ContainsConstraint, NUnit.Framework.Constraints.RangeConstraint, NUnit.Framework.Constraints.CollectionConstraint, NUnit.Framework.Constraints.ThrowsConstraint, NUnit.Framework.Constraints.PredicateConstraint< T >, NUnit.Framework.Constraints.PropertyExistsConstraint, NUnit.Framework.Constraints.AttributeExistsConstraint, NUnit.Framework.Constraints.AndConstraint, NUnit.Framework.Constraints.AttributeConstraint, NUnit.Framework.Constraints.TypeConstraint, NUnit.Framework.Constraints.ExactCountConstraint, NUnit.Framework.Constraints.SameAsConstraint, NUnit.Framework.Constraints.PropertyConstraint, NUnit.Framework.Constraints.BinarySerializableConstraint, NUnit.Framework.Constraints.AllItemsConstraint, NUnit.Framework.Constraints.EmptyDirectoryConstraint, NUnit.Framework.Constraints.NoItemConstraint, NUnit.Framework.Constraints.SomeItemsConstraint, NUnit.Framework.Constraints.XmlSerializableConstraint, NUnit.Framework.Constraints.OrConstraint, NUnit.Framework.Constraints.ThrowsNothingConstraint, NUnit.Framework.Constraints.EmptyConstraint, NUnit.Framework.Constraints.ThrowsExceptionConstraint, NUnit.Framework.Constraints.NotConstraint, NUnit.Framework.Constraints.ExceptionTypeConstraint, NUnit.Framework.Constraints.NaNConstraint, NUnit.Framework.Constraints.FalseConstraint, NUnit.Framework.Constraints.NullConstraint, and NUnit.Framework.Constraints.TrueConstraint.

virtual ConstraintResult NUnit.Framework.Constraints.Constraint.ApplyTo< TActual > ( ActualValueDelegate< TActual >  del)
inlinevirtual

Applies the constraint to an ActualValueDelegate that returns the value to be tested. The default implementation simply evaluates the delegate but derived classes may override it to provide for delayed processing.

Parameters
delAn ActualValueDelegate
Returns
A ConstraintResult

Implements NUnit.Framework.Constraints.IConstraint.

Reimplemented in NUnit.Framework.Constraints.DelayedConstraint, NUnit.Framework.Constraints.ThrowsConstraint, and NUnit.Framework.Constraints.ThrowsNothingConstraint.

virtual ConstraintResult NUnit.Framework.Constraints.Constraint.ApplyTo< TActual > ( ref TActual  actual)
inlinevirtual

Test whether the constraint is satisfied by a given reference. The default implementation simply dereferences the value but derived classes may override it to provide for delayed processing.

Parameters
actualA reference to the value to be tested
Returns
A ConstraintResult

Implements NUnit.Framework.Constraints.IConstraint.

Reimplemented in NUnit.Framework.Constraints.DelayedConstraint.

override string NUnit.Framework.Constraints.Constraint.ToString ( )
inline

Default override of ToString returns the constraint DisplayName followed by any arguments within angle brackets.

Returns

Referenced by NUnit.Framework.Syntax.MixedOperatorOverrides.ComplexTests(), and NUnit.Framework.Constraints.ConstraintTestBaseNoData.ProvidesProperStringRepresentation().

static string NUnit.Framework.Constraints.Constraint._displayable ( object  o)
inlinestaticprivate
static Constraint NUnit.Framework.Constraints.Constraint.operator& ( Constraint  left,
Constraint  right 
)
inlinestatic

This operator creates a constraint that is satisfied only if both argument constraints are satisfied.

References NUnit.Framework.Constraints.IResolveConstraint.Resolve().

static Constraint NUnit.Framework.Constraints.Constraint.operator| ( Constraint  left,
Constraint  right 
)
inlinestatic

This operator creates a constraint that is satisfied if either of the argument constraints is satisfied.

References NUnit.Framework.Constraints.IResolveConstraint.Resolve().

static Constraint NUnit.Framework.Constraints.Constraint.operator! ( Constraint  constraint)
inlinestatic

This operator creates a constraint that is satisfied if the argument constraint is not satisfied.

References NUnit.Framework.Constraints.IResolveConstraint.Resolve().

DelayedConstraint NUnit.Framework.Constraints.Constraint.After ( int  delayInMilliseconds)
inline

Returns a DelayedConstraint with the specified delay time.

Parameters
delayInMillisecondsThe delay in milliseconds.
Returns
DelayedConstraint NUnit.Framework.Constraints.Constraint.After ( int  delayInMilliseconds,
int  pollingInterval 
)
inline

Returns a DelayedConstraint with the specified delay time and polling interval.

Parameters
delayInMillisecondsThe delay in milliseconds.
pollingIntervalThe interval at which to test the constraint.
Returns
IConstraint IResolveConstraint. NUnit.Framework.Constraints.Constraint.Resolve ( )
inlineprivate

Resolves any pending operators and returns the resolved constraint.

Implements NUnit.Framework.Constraints.IResolveConstraint.

Property Documentation

string NUnit.Framework.Constraints.Constraint.DisplayName
getprotected set

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.

virtual string NUnit.Framework.Constraints.Constraint.Description
getprotected set
object [] NUnit.Framework.Constraints.Constraint.Arguments
getprivate set

Arguments provided to this Constraint, for use in formatting the description.

Referenced by NUnit.Framework.Constraints.EqualConstraintResult.EqualConstraintResult().

ConstraintBuilder NUnit.Framework.Constraints.Constraint.Builder
getset
ConstraintExpression NUnit.Framework.Constraints.Constraint.Or
get

Returns a ConstraintExpression by appending Or to the current constraint.


The documentation for this class was generated from the following file: