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
type
TypeThe expected type for the constraint
descriptionPrefix
stringPrefix 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
actual
TActualThe 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
actual
objectThe actual argument
Returns
- bool
True if the constraint succeeds, otherwise false.