Class TypeConstraint
- Namespace
- NUnit.Framework.Constraints
- Assembly
- nunit.framework.dll
TypeConstraint is the abstract base for constraints that take a Type as their expected value.
public abstract class TypeConstraint : Constraint, IConstraint, IResolveConstraint
- Inheritance
-
TypeConstraint
- Implements
- Derived
- Inherited Members
Constructors
TypeConstraint(Type, string)
Construct a TypeConstraint for a given Type
protected TypeConstraint(Type type, string descriptionPrefix)
Parameters
typeTypeThe expected type for the constraint
descriptionPrefixstringPrefix used in forming the constraint description
Fields
actualType
The type of the actual argument to which the constraint was applied
protected Type actualType
Field Value
expectedType
The expected Type used by the constraint
protected Type expectedType
Field Value
Methods
ApplyTo<TActual>(TActual)
Applies the constraint to an actual value, returning a ConstraintResult.
public override ConstraintResult ApplyTo<TActual>(TActual actual)
Parameters
actualTActualThe value to be tested
Returns
- ConstraintResult
A ConstraintResult
Type Parameters
TActual
Matches(object)
Apply the constraint to an actual value, returning true if it succeeds
protected abstract bool Matches(object actual)
Parameters
actualobjectThe actual argument
Returns
- bool
True if the constraint succeeds, otherwise false.