Class InstanceOfTypeConstraint
- Namespace
- NUnit.Framework.Constraints
- Assembly
- nunit.framework.dll
InstanceOfTypeConstraint is used to test that an object is of the same type provided or derived from it.
public class InstanceOfTypeConstraint : TypeConstraint, IConstraint, IResolveConstraint
- Inheritance
-
InstanceOfTypeConstraint
- Implements
- Inherited Members
Constructors
InstanceOfTypeConstraint(Type)
Construct an InstanceOfTypeConstraint for the type provided
public InstanceOfTypeConstraint(Type type)
Parameters
type
TypeThe expected Type
Properties
DisplayName
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.
public override string DisplayName { get; }
Property Value
Methods
Matches(object?)
Apply the constraint to an actual value, returning true if it succeeds
protected override bool Matches(object? actual)
Parameters
actual
objectThe actual argument
Returns
- bool
True if the constraint succeeds, otherwise false.