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