Summary
ConstraintExpression represents a compound constraint in the
process of being constructed from a series of syntactic elements.
Individual elements are appended to the expression as they are
recognized. Once an actual Constraint is appended, the expression
returns a resolvable Constraint.
- Namespace
- TCLite
.Constraints - Base Types
-
- object
- Derived Types
graph BT
Type-->Base0["object"]
Type["ConstraintExpression"]
class Type type-node
Derived0["ResolvableConstraintExpression"]-->Type
click Derived0 "/tc-lite/api/TCLite.Constraints/ResolvableConstraintExpression"
Derived1["ItemsConstraintExpression"]-->Type
click Derived1 "/tc-lite/api/TCLite.Constraints/ItemsConstraintExpression"
Syntax
public class ConstraintExpression
Remarks
This is a partial class, with the individual syntactic elements
like "Not", "All" or "EqualTo" distributed in individual files
for the constraint or operator they generate. For example, "Not"
is defined in NotOperator.cs and "EqualTo" in EqualConstraint.cs.
Constructors
Name | Summary |
---|---|
ConstraintExpression |
Initializes a new instance of the ConstraintExpression class.
|
ConstraintExpression |
Initializes a new instance of the ConstraintExpression
class passing in a ConstraintBuilder, which may be pre-populated.
|
Properties
Name | Value | Summary |
---|---|---|
Builder | ConstraintBuilder |
The ConstraintBuilder associated with this expression
|
False | FalseConstraint |
Returns a constraint that tests for False
|
Negative | LessThanConstraint |
Returns a constraint that tests for a negative value
|
Null | NullConstraint |
Returns a constraint that tests for null
|
One | Items |
Returns a
ItemsConstraintExpression which will apply
the following constraint to only one member of the collection,
and fail if none or more than one match occurs.
|
Positive | Greater |
Returns a constraint that tests for a positive value
|
True | TrueConstraint |
Returns a constraint that tests for True
|
Unique | Unique |
Returns a constraint that tests whether a collection
contains all unique items.
|
Zero | EqualConstraint |
Returns a constraint that tests if item is equal to zero
|
Methods
Name | Value | Summary |
---|---|---|
Append |
Constraint |
Appends a constraint to the expression and returns that
constraint, which is associated with the current state
of the expression being built.
|
Append |
ConstraintExpression |
Appends an operator to the expression and returns the
resulting expression itself.
|
Append |
Resolvable |
Appends a self-resolving operator to the expression and
returns a new ResolvableConstraintExpression.
|
AtLeast |
Greater |
Returns a constraint that tests whether the
actual value is greater than or equal to the suppled argument
|
AtMost |
Less |
Returns a constraint that tests whether the
actual value is less than or equal to the suppled argument
|
Contains |
ContainsConstraint |
Returns a new ContainsConstraint. This constraint
will, in turn, make use of the appropriate second-level
constraint, depending on the type of the actual argument.
This overload is only used if the item sought is a string,
since any other type implies that we are looking for a
collection member.
|
ContainsSubstring |
SubstringConstraint |
Returns a constraint that succeeds if the actual
value contains the substring supplied as an argument.
|
EndsWith |
EndsWithConstraint |
Returns a constraint that succeeds if the actual
value ends with the substring supplied as an argument.
|
EqualTo |
EqualConstraint |
Returns a constraint that tests two items for equality
|
EquivalentTo |
Collection |
Returns a constraint that tests whether the actual value
is a collection containing the same elements as the
collection supplied as an argument.
|
Exactly |
Items |
Returns a ConstraintExpression, which will apply
the following constraint to all members of a collection,
succeeding only if a specified number of them succeed.
|
GreaterThan |
Greater |
Returns a constraint that tests whether the
actual value is greater than the suppled argument
|
GreaterThanOrEqualTo |
Greater |
Returns a constraint that tests whether the
actual value is greater than or equal to the suppled argument
|
InRange |
RangeConstraint |
Returns a constraint that tests whether the actual value falls
within a specified range.
|
InstanceOf |
Instance |
Returns a constraint that tests whether the actual value
is of the type supplied as an argument or a derived type.
|
InstanceOf |
Instance |
Returns a constraint that tests whether the actual value
is of the type supplied as an argument or a derived type.
|
LessThan |
LessThanConstraint |
Returns a constraint that tests whether the
actual value is less than the suppled argument
|
LessThanOrEqualTo |
Less |
Returns a constraint that tests whether the
actual value is less than or equal to the suppled argument
|
Matches |
RegexConstraint |
Returns a constraint that succeeds if the actual
value matches the regular expression supplied as an argument.
|
Matches |
RegexConstraint |
Returns a constraint that succeeds if the actual
value matches the regular expression supplied as an argument.
|
SameAs |
SameAsConstraint |
Returns a constraint that tests that two references are the same object
|
StartsWith |
StartsWithConstraint |
Returns a constraint that succeeds if the actual
value starts with the substring supplied as an argument.
|
TypeOf |
ExactTypeConstraint |
Returns a constraint that tests whether the actual
value is of the exact type supplied as an argument.
|
TypeOf |
ExactTypeConstraint |
Returns a constraint that tests whether the actual
value is of the exact type supplied as an argument.
|