ConstraintExpression Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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 reognized. Once an actual Constraint is appended, the expression returns a resolvable Constraint.
public class ConstraintExpression : NUnit.Framework.Constraints.ConstraintExpressionBase
type ConstraintExpression = class
inherit ConstraintExpressionBase
- Inheritance
- Derived
Constructors
ConstraintExpression() |
Initializes a new instance of the ConstraintExpression class. |
ConstraintExpression(ConstraintBuilder) |
Initializes a new instance of the ConstraintExpression class passing in a ConstraintBuilder, which may be pre-populated. |
Fields
builder |
The ConstraintBuilder holding the elements recognized so far (Inherited from ConstraintExpressionBase) |
Properties
All |
Returns a ConstraintExpression, which will apply the following constraint to all members of a collection, succeeding if all of them succeed. |
BinarySerializable |
Returns a constraint that tests whether an object graph is serializable in binary format. |
Count |
Returns a new ConstraintExpression, which will apply the following constraint to the Count property of the object being tested. |
Empty |
Returns a constraint that tests for empty |
False |
Returns a constraint that tests for False |
InnerException |
Returns a new ConstraintExpression, which will apply the following constraint to the InnerException property of the object being tested. |
Length |
Returns a new ConstraintExpression, which will apply the following constraint to the Length property of the object being tested. |
Message |
Returns a new ConstraintExpression, which will apply the following constraint to the Message property of the object being tested. |
NaN |
Returns a constraint that tests for NaN |
Negative | |
No |
Returns a ConstraintExpression that negates any following constraint. |
None |
Returns a ConstraintExpression, which will apply the following constraint to all members of a collection, succeeding if all of them fail. |
Not |
Returns a ConstraintExpression that negates any following constraint. |
Null |
Returns a constraint that tests for null |
Ordered |
Returns a constraint that tests whether a collection is ordered |
Positive | |
Some |
Returns a ConstraintExpression, which will apply the following constraint to all members of a collection, succeeding if at least one of them succeeds. |
True |
Returns a constraint that tests for True |
Unique |
Returns a constraint that tests whether a collection contains all unique items. |
With |
With is currently a NOP - reserved for future use. |
XmlSerializable |
Returns a constraint that tests whether an object graph is serializable in xml format. |
Methods
Append(Constraint) |
Appends a constraint to the expression and returns that constraint, which is associated with the current state of the expression being built. (Inherited from ConstraintExpressionBase) |
Append(ConstraintOperator) |
Appends an operator to the expression and returns the resulting expression itself. (Inherited from ConstraintExpressionBase) |
Append(SelfResolvingOperator) |
Appends a self-resolving operator to the expression and returns a new ResolvableConstraintExpression. (Inherited from ConstraintExpressionBase) |
AssignableFrom(Type) |
Returns a constraint that tests whether the actual value is assignable from the type supplied as an argument. |
AssignableFrom<T>() |
Returns a constraint that tests whether the actual value is assignable from the type supplied as an argument. |
AssignableTo(Type) |
Returns a constraint that tests whether the actual value is assignable from the type supplied as an argument. |
AssignableTo<T>() |
Returns a constraint that tests whether the actual value is assignable from the type supplied as an argument. |
AtLeast(Object) |
Returns a constraint that tests whether the actual value is greater than or equal to the suppled argument |
AtMost(Object) |
Returns a constraint that tests whether the actual value is less than or equal to the suppled argument |
Attribute(Type) |
Returns a new AttributeConstraint checking for the presence of a particular attribute on an object. |
Attribute<T>() |
Returns a new AttributeConstraint checking for the presence of a particular attribute on an object. |
Contains(Object) |
Returns a new CollectionContainsConstraint checking for the presence of a particular object in the collection. |
Contains(String) |
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(String) |
Returns a constraint that succeeds if the actual value contains the substring supplied as an argument. |
EndsWith(String) |
Returns a constraint that succeeds if the actual value ends with the substring supplied as an argument. |
EqualTo(Object) |
Returns a constraint that tests two items for equality |
EquivalentTo(IEnumerable) |
Returns a constraint that tests whether the actual value is a collection containing the same elements as the collection supplied as an argument. |
Exactly(Int32) | |
GreaterThan(Object) |
Returns a constraint that tests whether the actual value is greater than the suppled argument |
GreaterThanOrEqualTo(Object) |
Returns a constraint that tests whether the actual value is greater than or equal to the suppled argument |
InRange<T>(T, T) | |
InstanceOf(Type) |
Returns a constraint that tests whether the actual value is of the type supplied as an argument or a derived type. |
InstanceOf<T>() |
Returns a constraint that tests whether the actual value is of the type supplied as an argument or a derived type. |
LessThan(Object) |
Returns a constraint that tests whether the actual value is less than the suppled argument |
LessThanOrEqualTo(Object) |
Returns a constraint that tests whether the actual value is less than or equal to the suppled argument |
Matches(Constraint) |
Returns the constraint provided as an argument - used to allow custom custom constraints to easily participate in the syntax. |
Matches(String) |
Returns a constraint that succeeds if the actual value matches the Regex pattern supplied as an argument. |
Matches<T>(Predicate<T>) |
Returns the constraint provided as an argument - used to allow custom custom constraints to easily participate in the syntax. |
Member(Object) |
Returns a new CollectionContainsConstraint checking for the presence of a particular object in the collection. |
Property(String) |
Returns a new PropertyConstraintExpression, which will either test for the existence of the named property on the object being tested or apply any following constraint to that property. |
SameAs(Object) |
Returns a constraint that tests that two references are the same object |
SamePath(String) |
Returns a constraint that tests whether the path provided is the same as an expected path after canonicalization. |
SamePathOrUnder(String) |
Returns a constraint that tests whether the path provided is the same path or under an expected path after canonicalization. |
StartsWith(String) |
Returns a constraint that succeeds if the actual value starts with the substring supplied as an argument. |
StringContaining(String) |
Returns a constraint that succeeds if the actual value contains the substring supplied as an argument. |
StringEnding(String) |
Returns a constraint that succeeds if the actual value ends with the substring supplied as an argument. |
StringMatching(String) |
Returns a constraint that succeeds if the actual value matches the Regex pattern supplied as an argument. |
StringStarting(String) |
Returns a constraint that succeeds if the actual value starts with the substring supplied as an argument. |
SubPath(String) | |
SubsetOf(IEnumerable) |
Returns a constraint that tests whether the actual value is a subset of the collection supplied as an argument. |
ToString() |
Returns a string representation of the expression as it currently stands. This should only be used for testing, since it has the side-effect of resolving the expression. (Inherited from ConstraintExpressionBase) |
TypeOf(Type) |
Returns a constraint that tests whether the actual value is of the exact type supplied as an argument. |
TypeOf<T>() |
Returns a constraint that tests whether the actual value is of the exact type supplied as an argument. |