IGLib
1.7.2
The IGLib base library EXTENDED - with other lilbraries and applications.
|
The Constraint class is the base of all built-in constraints within NUnit. It provides the operator overloads used to combine constraints. More...
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... | |
![]() | |
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) |
The Constraint class is the base of all built-in constraints within NUnit. It provides the operator overloads used to combine constraints.
|
inlineprotected |
Construct a constraint with optional arguments
args | Arguments to be saved |
|
pure virtual |
Applies the constraint to an actual value, returning a ConstraintResult.
actual | The value to be tested |
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.
|
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.
del | An ActualValueDelegate |
Implements NUnit.Framework.Constraints.IConstraint.
Reimplemented in NUnit.Framework.Constraints.DelayedConstraint, NUnit.Framework.Constraints.ThrowsConstraint, and NUnit.Framework.Constraints.ThrowsNothingConstraint.
|
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.
actual | A reference to the value to be tested |
Implements NUnit.Framework.Constraints.IConstraint.
Reimplemented in NUnit.Framework.Constraints.DelayedConstraint.
|
inline |
Default override of ToString returns the constraint DisplayName followed by any arguments within angle brackets.
Referenced by NUnit.Framework.Syntax.MixedOperatorOverrides.ComplexTests(), and NUnit.Framework.Constraints.ConstraintTestBaseNoData.ProvidesProperStringRepresentation().
|
inlineprotectedvirtual |
Returns the string representation of this constraint
Reimplemented in NUnit.Framework.Constraints.DelayedConstraint, NUnit.Framework.Constraints.CollectionOrderedConstraint, NUnit.Framework.Constraints.XmlSerializableConstraint, NUnit.Framework.Constraints.PropertyExistsConstraint, NUnit.Framework.Constraints.BinarySerializableConstraint, NUnit.Framework.Constraints.PropertyConstraint, NUnit.Framework.Constraints.AttributeConstraint, and NUnit.Framework.Constraints.PathConstraint.
|
inlinestaticprivate |
|
inlinestatic |
This operator creates a constraint that is satisfied only if both argument constraints are satisfied.
References NUnit.Framework.Constraints.IResolveConstraint.Resolve().
|
inlinestatic |
This operator creates a constraint that is satisfied if either of the argument constraints is satisfied.
References NUnit.Framework.Constraints.IResolveConstraint.Resolve().
|
inlinestatic |
This operator creates a constraint that is satisfied if the argument constraint is not satisfied.
References NUnit.Framework.Constraints.IResolveConstraint.Resolve().
|
inline |
Returns a DelayedConstraint with the specified delay time.
delayInMilliseconds | The delay in milliseconds. |
|
inline |
Returns a DelayedConstraint with the specified delay time and polling interval.
delayInMilliseconds | The delay in milliseconds. |
pollingInterval | The interval at which to test the constraint. |
|
inlineprivate |
Resolves any pending operators and returns the resolved constraint.
Implements NUnit.Framework.Constraints.IResolveConstraint.
|
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.
|
getprotected set |
The Description of what this constraint tests, for use in messages and in the ConstraintResult.
Referenced by NUnit.Framework.Constraints.PropertyTest.PropertyEqualToValueWithTolerance(), and NUnit.Framework.Constraints.ConstraintTestBaseNoData.ProvidesProperDescription().
|
getprivate set |
Arguments provided to this Constraint, for use in formatting the description.
Referenced by NUnit.Framework.Constraints.EqualConstraintResult.EqualConstraintResult().
|
getset |
The ConstraintBuilder holding this constraint
Referenced by NUnit.Framework.Constraints.ConstraintBuilder.Append().
|
get |
Returns a ConstraintExpression by appending And to the current constraint.
Referenced by NUnit.Framework.Syntax.ArbitraryConstraintMatching.CanMatchCustomConstraintsUnderAndOperator(), NUnit.Framework.Syntax.ThrowsTests.LambdaThrowsExceptionWithMessage(), NUnit.Framework.Syntax.ThrowsTests.ThrowsExceptionTypeOfAndConstraint(), and NUnit.Framework.Syntax.ThrowsTests.ThrowsTypeOfAndConstraint().
|
get |
Returns a ConstraintExpression by appending And to the current constraint.
Referenced by NUnit.Framework.Tests.Constraints.DictionaryContainsKeyConstraintTests.FailsWhenNotUsedAgainstADictionary(), NUnit.Framework.Tests.Constraints.DictionaryContainsValueConstraintTests.FailsWhenNotUsedAgainstADictionary(), NUnit.Framework.Tests.Constraints.ToleranceTests.TestModeMustFollowTolerance(), NUnit.Framework.Tests.Constraints.ToleranceTests.TestModesCanOnlyBeUsedOnce(), NUnit.Framework.Tests.Constraints.ToleranceTests.TestNumericToleranceRequired(), and NUnit.Framework.Syntax.ThrowsTests.ThrowsTypeOfWithConstraint().
|
get |
Returns a ConstraintExpression by appending Or to the current constraint.