Search Results for

    Show / Hide Table of Contents

    Class Has

    Helper class with properties and methods that supply a number of constraints used in Asserts.

    Inheritance
    object
    Has
    Inherited Members
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: NUnit.Framework
    Assembly: nunit.framework.dll
    Syntax
    public abstract class Has

    Constructors

    View Source

    Has()

    Declaration
    protected Has()

    Properties

    View Source

    All

    Returns a ConstraintExpression, which will apply the following constraint to all members of a collection, succeeding if all of them succeed.

    Declaration
    public static ConstraintExpression All { get; }
    Property Value
    Type Description
    ConstraintExpression
    View Source

    Count

    Returns a new ConstraintExpression, which will apply the following constraint to the Count property of the object being tested.

    Declaration
    public static ResolvableConstraintExpression Count { get; }
    Property Value
    Type Description
    ResolvableConstraintExpression
    View Source

    InnerException

    Returns a new ConstraintExpression, which will apply the following constraint to the InnerException property of the object being tested.

    Declaration
    public static ResolvableConstraintExpression InnerException { get; }
    Property Value
    Type Description
    ResolvableConstraintExpression
    View Source

    Length

    Returns a new ConstraintExpression, which will apply the following constraint to the Length property of the object being tested.

    Declaration
    public static ResolvableConstraintExpression Length { get; }
    Property Value
    Type Description
    ResolvableConstraintExpression
    View Source

    Message

    Returns a new ConstraintExpression, which will apply the following constraint to the Message property of the object being tested.

    Declaration
    public static ResolvableConstraintExpression Message { get; }
    Property Value
    Type Description
    ResolvableConstraintExpression
    View Source

    No

    Returns a ConstraintExpression that negates any following constraint.

    Declaration
    public static ConstraintExpression No { get; }
    Property Value
    Type Description
    ConstraintExpression
    View Source

    None

    Returns a ConstraintExpression, which will apply the following constraint to all members of a collection, succeeding if all of them fail.

    Declaration
    public static ConstraintExpression None { get; }
    Property Value
    Type Description
    ConstraintExpression
    View Source

    One

    Returns a ItemsConstraintExpression which will apply the following constraint to only one member of the collection, and fail if none or more than one match occurs.

    Declaration
    public static ItemsConstraintExpression One { get; }
    Property Value
    Type Description
    ItemsConstraintExpression
    View Source

    Some

    Returns a ConstraintExpression, which will apply the following constraint to all members of a collection, succeeding if at least one of them succeeds.

    Declaration
    public static ConstraintExpression Some { get; }
    Property Value
    Type Description
    ConstraintExpression

    Methods

    View Source

    Attribute(Type)

    Returns a new AttributeConstraint checking for the presence of a particular attribute on an object.

    Declaration
    public static ResolvableConstraintExpression Attribute(Type expectedType)
    Parameters
    Type Name Description
    Type expectedType
    Returns
    Type Description
    ResolvableConstraintExpression
    View Source

    Attribute<T>()

    Returns a new AttributeConstraint checking for the presence of a particular attribute on an object.

    Declaration
    public static ResolvableConstraintExpression Attribute<T>()
    Returns
    Type Description
    ResolvableConstraintExpression
    Type Parameters
    Name Description
    T
    View Source

    Exactly(int)

    Returns a ConstraintExpression, which will apply the following constraint to all members of a collection, succeeding only if a specified number of them succeed.

    Declaration
    public static ItemsConstraintExpression Exactly(int expectedCount)
    Parameters
    Type Name Description
    int expectedCount
    Returns
    Type Description
    ItemsConstraintExpression
    View Source

    ItemAt(params object[])

    Returns a new IndexerConstraintExpression, which will apply any following constraint to that indexer value.

    Declaration
    public static ConstraintExpression ItemAt(params object[] indexArgs)
    Parameters
    Type Name Description
    object[] indexArgs

    Index accessor values.

    Returns
    Type Description
    ConstraintExpression
    View Source

    Member(object?)

    Returns a new SomeItemsConstraint checking for the presence of a particular object in the collection.

    Declaration
    public static SomeItemsConstraint Member(object? expected)
    Parameters
    Type Name Description
    object expected
    Returns
    Type Description
    SomeItemsConstraint
    View Source

    Property(string)

    Returns a new PropertyConstraintExpression, which will either test for the existence of the named property on the object being tested or apply any following constraint to that property.

    Declaration
    public static ResolvableConstraintExpression Property(string name)
    Parameters
    Type Name Description
    string name
    Returns
    Type Description
    ResolvableConstraintExpression
    • 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