ExpectedValueConstraint<TExpected> Class

Summary

ExpectedValueConstraint is a constraint taking an expected value as a constructor argument, which any actual value is supposed to match in some way. In some cases, the Type of the expected value is used in determining the Types allowed as actual values.
graph BT Type-->Base0["Constraint"] click Base0 "/tc-lite/api/TCLite.Constraints/Constraint" Base0-->Base1["object"] Type-.->Interface0["IConstraint"] click Interface0 "/tc-lite/api/TCLite.Constraints/IConstraint" Type-.->Interface1["IResolveConstraint"] click Interface1 "/tc-lite/api/TCLite.Constraints/IResolveConstraint" Type["ExpectedValueConstraint<TExpected>"] class Type type-node Derived0["ComparisonConstraint<TExpected>"]-->Type click Derived0 "/tc-lite/api/TCLite.Constraints/ComparisonConstraint_1" Derived1["StringConstraint"]-->Type click Derived1 "/tc-lite/api/TCLite.Constraints/StringConstraint" Derived2["TypeConstraint"]-->Type click Derived2 "/tc-lite/api/TCLite.Constraints/TypeConstraint" Derived3["SameAsConstraint<TExpected>"]-->Type click Derived3 "/tc-lite/api/TCLite.Constraints/SameAsConstraint_1" Derived4["ContainsConstraint<TExpected>"]-->Type click Derived4 "/tc-lite/api/TCLite.Constraints/ContainsConstraint_1" Derived5["EqualConstraint<TExpected>"]-->Type click Derived5 "/tc-lite/api/TCLite.Constraints/EqualConstraint_1"

Syntax

public abstract class ExpectedValueConstraint<TExpected> : Constraint, IConstraint, 
    IResolveConstraint

Type Parameters

Name Description
TExpected Type of the ExpectedValue

Constructors

Fields

Name Constant Value Summary
ExpectedValue

Properties

Name Value Summary
And ConstraintExpression
Returns a ConstraintExpression by appending And to the current constraint.
Inherited from Constraint
Arguments object[]
Arguments provided to this Constraint, for use in formatting the description.
Inherited from Constraint
Builder ConstraintBuilder
A ConstraintBuilder holding this constraint. If not null the constraint is under construction.
Inherited from Constraint
Description string
The Description of what this constraint tests, for use in messages and in the ConstraintResult.
Inherited from Constraint
DisplayName string
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.
Inherited from Constraint
Or ConstraintExpression
Returns a ConstraintExpression by appending Or to the current constraint.
Inherited from Constraint
With ConstraintExpression
Returns a ConstraintExpression by appending And to the current constraint.
Inherited from Constraint

Methods

Name Value Summary
ApplyConstraint<T>(ActualValueDelegate<T>) ConstraintResult
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.
Inherited from Constraint
ApplyConstraint<T>(T) ConstraintResult
Applies the constraint to the value to be tested and returns a ConstraintResult.
Inherited from Constraint
ApplyConstraint<T>(T) ConstraintResult
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.
Inherited from Constraint
ApplyTo<T>(ActualValueDelegate<T>) ConstraintResult
Validates the ActualValueDelegate and applies the constraint to the value it returns.
Inherited from Constraint
ApplyTo<T>(T) ConstraintResult
Validates the actual value argument and applies the constraint to it, returning a ConstraintResult.
Inherited from Constraint
ApplyTo<T>(T) ConstraintResult
Validates the actual value argument and applies the constraint to it, returning a ConstraintResult.
Inherited from Constraint
GetStringRepresentation() string
Returns the string representation of this constraint
Inherited from Constraint
ToString() string
Default override of ToString returns the constraint DisplayName followed by any arguments within angle brackets.
Inherited from Constraint
ValidateActualValue(object) void
Validate the actual value argument based on what the particular constraint allows. The default implementation does nothing, implying that the constraint can handle any Type as well as null values.
Inherited from Constraint