Search Results for

    Show / Hide Table of Contents

    Class Does

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

    Inheritance
    object
    Does
    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 Does

    Constructors

    View Source

    Does()

    Declaration
    protected Does()

    Properties

    View Source

    Exist

    Returns a constraint that succeeds if the value is a file or directory and it exists.

    Declaration
    public static FileOrDirectoryExistsConstraint Exist { get; }
    Property Value
    Type Description
    FileOrDirectoryExistsConstraint
    View Source

    Not

    Returns a ConstraintExpression that negates any following constraint.

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

    Methods

    View Source

    Contain(object?)

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

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

    Contain(string?)

    Returns a new ContainsConstraint. This constraint will, in turn, make use of the appropriate second-level constraint, depending on the type of the actual argument. This overload is only used if the item sought is a string, since any other type implies that we are looking for a collection member.

    Declaration
    public static ContainsConstraint Contain(string? expected)
    Parameters
    Type Name Description
    string expected
    Returns
    Type Description
    ContainsConstraint
    View Source

    ContainKey(object)

    Returns a new DictionaryContainsKeyConstraint checking for the presence of a particular key in the Dictionary key collection.

    Declaration
    public static DictionaryContainsKeyConstraint ContainKey(object expected)
    Parameters
    Type Name Description
    object expected

    The key to be matched in the Dictionary key collection

    Returns
    Type Description
    DictionaryContainsKeyConstraint
    View Source

    ContainValue(object?)

    Returns a new DictionaryContainsValueConstraint checking for the presence of a particular value in the Dictionary value collection.

    Declaration
    public static DictionaryContainsValueConstraint ContainValue(object? expected)
    Parameters
    Type Name Description
    object expected

    The value to be matched in the Dictionary value collection

    Returns
    Type Description
    DictionaryContainsValueConstraint
    View Source

    EndWith(string)

    Returns a constraint that succeeds if the actual value ends with the substring supplied as an argument.

    Declaration
    public static EndsWithConstraint EndWith(string expected)
    Parameters
    Type Name Description
    string expected
    Returns
    Type Description
    EndsWithConstraint
    View Source

    Match(string)

    Returns a constraint that succeeds if the actual value matches the regular expression supplied as an argument.

    Declaration
    public static RegexConstraint Match(string pattern)
    Parameters
    Type Name Description
    string pattern
    Returns
    Type Description
    RegexConstraint
    View Source

    Match(Regex)

    Returns a constraint that succeeds if the actual value matches the regular expression supplied as an argument.

    Declaration
    public static RegexConstraint Match(Regex regex)
    Parameters
    Type Name Description
    Regex regex
    Returns
    Type Description
    RegexConstraint
    View Source

    StartWith(string)

    Returns a constraint that succeeds if the actual value starts with the substring supplied as an argument.

    Declaration
    public static StartsWithConstraint StartWith(string expected)
    Parameters
    Type Name Description
    string expected
    Returns
    Type Description
    StartsWithConstraint
    • 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