Search Results for

    Show / Hide Table of Contents

    Class TypeConstraint

    TypeConstraint is the abstract base for constraints that take a Type as their expected value.

    Inheritance
    object
    Constraint
    TypeConstraint
    AssignableFromConstraint
    AssignableToConstraint
    ExactTypeConstraint
    InstanceOfTypeConstraint
    Implements
    IConstraint
    IResolveConstraint
    Inherited Members
    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.DisplayName
    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 abstract class TypeConstraint : Constraint, IConstraint, IResolveConstraint

    Constructors

    View Source

    TypeConstraint(Type, string)

    Construct a TypeConstraint for a given Type

    Declaration
    protected TypeConstraint(Type type, string descriptionPrefix)
    Parameters
    Type Name Description
    Type type

    The expected type for the constraint

    string descriptionPrefix

    Prefix used in forming the constraint description

    Fields

    View Source

    actualType

    The type of the actual argument to which the constraint was applied

    Declaration
    protected Type? actualType
    Field Value
    Type Description
    Type
    View Source

    expectedType

    The expected Type used by the constraint

    Declaration
    protected Type expectedType
    Field Value
    Type Description
    Type

    Properties

    View Source

    Description

    The Description of what this constraint tests, for use in messages and in the ConstraintResult.

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

    Methods

    View Source

    ApplyTo<TActual>(TActual)

    Applies the constraint to an actual value, returning a ConstraintResult.

    Declaration
    public override ConstraintResult ApplyTo<TActual>(TActual actual)
    Parameters
    Type Name Description
    TActual actual

    The value to be tested

    Returns
    Type Description
    ConstraintResult

    A ConstraintResult

    Type Parameters
    Name Description
    TActual
    Overrides
    Constraint.ApplyTo<TActual>(TActual)
    View Source

    Matches(object?)

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

    Declaration
    protected abstract bool Matches(object? actual)
    Parameters
    Type Name Description
    object actual

    The actual argument

    Returns
    Type Description
    bool

    True if the constraint succeeds, otherwise false.

    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