Table of Contents

Class Does

Namespace
NUnit.Framework
Assembly
nunit.framework.dll

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

public abstract class Does
Inheritance
Does
Inherited Members

Constructors

Does()

protected Does()

Properties

Exist

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

public static FileOrDirectoryExistsConstraint Exist { get; }

Property Value

FileOrDirectoryExistsConstraint

Not

Returns a ConstraintExpression that negates any following constraint.

public static ConstraintExpression Not { get; }

Property Value

ConstraintExpression

Methods

Contain(object?)

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

public static SomeItemsConstraint Contain(object? expected)

Parameters

expected object

Returns

SomeItemsConstraint

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.

public static ContainsConstraint Contain(string? expected)

Parameters

expected string

Returns

ContainsConstraint

ContainKey(object)

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

public static DictionaryContainsKeyConstraint ContainKey(object expected)

Parameters

expected object

The key to be matched in the Dictionary key collection

Returns

DictionaryContainsKeyConstraint

ContainValue(object)

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

public static DictionaryContainsValueConstraint ContainValue(object expected)

Parameters

expected object

The value to be matched in the Dictionary value collection

Returns

DictionaryContainsValueConstraint

EndWith(string)

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

public static EndsWithConstraint EndWith(string expected)

Parameters

expected string

Returns

EndsWithConstraint

Match(string)

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

public static RegexConstraint Match(string pattern)

Parameters

pattern string

Returns

RegexConstraint

Match(Regex)

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

public static RegexConstraint Match(Regex regex)

Parameters

regex Regex

Returns

RegexConstraint

StartWith(string)

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

public static StartsWithConstraint StartWith(string expected)

Parameters

expected string

Returns

StartsWithConstraint