Table of Contents

Class ExactTypeConstraint

Namespace
NUnit.Framework.Constraints
Assembly
nunit.framework.dll

ExactTypeConstraint is used to test that an object is of the exact type provided in the constructor

public class ExactTypeConstraint : TypeConstraint, IConstraint, IResolveConstraint
Inheritance
ExactTypeConstraint
Implements
Derived
Inherited Members

Constructors

ExactTypeConstraint(Type)

Construct an ExactTypeConstraint for a given Type

public ExactTypeConstraint(Type type)

Parameters

type Type

The 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

string

Methods

Matches(object?)

Apply the constraint to an actual value, returning true if it succeeds

protected override bool Matches(object? actual)

Parameters

actual object

The actual argument

Returns

bool

True if the constraint succeeds, otherwise false.