Search Results for

    Show / Hide Table of Contents

    Class InstanceOfTypeConstraint

    InstanceOfTypeConstraint is used to test that an object is of the same type provided or derived from it.

    Inheritance
    object
    Constraint
    TypeConstraint
    InstanceOfTypeConstraint
    Implements
    IConstraint
    IResolveConstraint
    Inherited Members
    TypeConstraint.expectedType
    TypeConstraint.actualType
    TypeConstraint.ApplyTo<TActual>(TActual)
    TypeConstraint.Description
    Constraint.ApplyTo<TActual>(ActualValueDelegate<TActual>)
    Constraint.ApplyTo<TActual>(ref TActual)
    Constraint.ApplyToAsync<TActual>(Func<Task<TActual>>)
    Constraint.GetTestObject<TActual>(ActualValueDelegate<TActual>)
    Constraint.ToString()
    Constraint.GetStringRepresentation(IEnumerable)
    Constraint.GetStringRepresentation()
    Constraint.After(int)
    Constraint.After(int, int)
    Constraint.Arguments
    Constraint.Builder
    Constraint.And
    Constraint.With
    Constraint.Or
    object.GetType()
    object.MemberwiseClone()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: NUnit.Framework.Constraints
    Assembly: nunit.framework.dll
    Syntax
    public class InstanceOfTypeConstraint : TypeConstraint, IConstraint, IResolveConstraint

    Constructors

    View Source

    InstanceOfTypeConstraint(Type)

    Construct an InstanceOfTypeConstraint for the type provided

    Declaration
    public InstanceOfTypeConstraint(Type type)
    Parameters
    Type Name Description
    Type type

    The expected Type

    Properties

    View Source

    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.

    Declaration
    public override string DisplayName { get; }
    Property Value
    Type Description
    string
    Overrides
    Constraint.DisplayName

    Methods

    View Source

    Matches(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.

    Overrides
    TypeConstraint.Matches(object?)

    Implements

    IConstraint
    IResolveConstraint
    • View Source
    In this article
    Back to top Generated by DocFX | Copyright (c) 2018- The NUnit Project - Licensed under CC BY-NC-SA 4.0