C# Класс NUnit.Framework.Assert

The Assert class contains a collection of static methods that implement the most common assertions used in NUnit.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
Contains ( object expected, ICollection actual ) : void

Asserts that an object is contained in a collection.

Contains ( object expected, ICollection actual, string message ) : void

Asserts that an object is contained in a collection.

Fail ( ) : void

Throws an AssertionException. This is used by the other Assert functions.

Fail ( string message ) : void

Throws an AssertionException with the message and arguments that are passed in. This is used by the other Assert functions.

Ignore ( ) : void

Throws an IgnoreException. This causes the test to be reported as ignored.

Ignore ( string message ) : void

Throws an IgnoreException with the message and arguments that are passed in. This causes the test to be reported as ignored.

Inconclusive ( ) : void

Throws an InconclusiveException. This causes the test to be reported as Inconclusive.

Inconclusive ( string message ) : void

Throws an InconclusiveException with the message and arguments that are passed in. This causes the test to be reported as inconclusive.

Multiple ( TestDelegate testDelegate ) : void

Wraps code containing a series of assertions, which should all be executed, even if they fail. Failed results are saved and reported at the end of the code block.

Pass ( ) : void

Throws a SuccessException with the message and arguments that are passed in. This allows a test to be cut short, with a result of success returned to NUnit.

Pass ( string message ) : void

Throws a SuccessException with the message and arguments that are passed in. This allows a test to be cut short, with a result of success returned to NUnit.

Warn ( string message ) : void

Issues a warning using the message and arguments provided.

Защищенные методы

Метод Описание
Assert ( ) : System

We don't actually want any instances of this object, but some people like to inherit from it to add other static methods. Hence, the protected constructor disallows any instances of this object.

Приватные методы

Метод Описание
Equals ( object a, object b ) : bool
GetStackTrace ( ) : string
IncrementAssertCount ( ) : void
IssueWarning ( string message ) : void
ReferenceEquals ( object a, object b ) : void
ReportFailure ( ConstraintResult result, string message ) : void
ReportFailure ( string message ) : void

Описание методов

Assert() защищенный Метод

We don't actually want any instances of this object, but some people like to inherit from it to add other static methods. Hence, the protected constructor disallows any instances of this object.
protected Assert ( ) : System
Результат System

Contains() публичный статический Метод

Asserts that an object is contained in a collection.
public static Contains ( object expected, ICollection actual ) : void
expected object The expected object
actual ICollection The collection to be examined
Результат void

Contains() публичный статический Метод

Asserts that an object is contained in a collection.
public static Contains ( object expected, ICollection actual, string message ) : void
expected object The expected object
actual ICollection The collection to be examined
message string The message to display in case of failure
Результат void

Fail() статический публичный Метод

Throws an AssertionException. This is used by the other Assert functions.
static public Fail ( ) : void
Результат void

Fail() статический публичный Метод

Throws an AssertionException with the message and arguments that are passed in. This is used by the other Assert functions.
static public Fail ( string message ) : void
message string The message to initialize the with.
Результат void

Ignore() статический публичный Метод

Throws an IgnoreException. This causes the test to be reported as ignored.
static public Ignore ( ) : void
Результат void

Ignore() статический публичный Метод

Throws an IgnoreException with the message and arguments that are passed in. This causes the test to be reported as ignored.
static public Ignore ( string message ) : void
message string The message to initialize the with.
Результат void

Inconclusive() статический публичный Метод

Throws an InconclusiveException. This causes the test to be reported as Inconclusive.
static public Inconclusive ( ) : void
Результат void

Inconclusive() статический публичный Метод

Throws an InconclusiveException with the message and arguments that are passed in. This causes the test to be reported as inconclusive.
static public Inconclusive ( string message ) : void
message string The message to initialize the with.
Результат void

Multiple() публичный статический Метод

Wraps code containing a series of assertions, which should all be executed, even if they fail. Failed results are saved and reported at the end of the code block.
public static Multiple ( TestDelegate testDelegate ) : void
testDelegate TestDelegate A TestDelegate to be executed in Multiple Assertion mode.
Результат void

Pass() статический публичный Метод

Throws a SuccessException with the message and arguments that are passed in. This allows a test to be cut short, with a result of success returned to NUnit.
static public Pass ( ) : void
Результат void

Pass() статический публичный Метод

Throws a SuccessException with the message and arguments that are passed in. This allows a test to be cut short, with a result of success returned to NUnit.
static public Pass ( string message ) : void
message string The message to initialize the with.
Результат void

Warn() статический публичный Метод

Issues a warning using the message and arguments provided.
static public Warn ( string message ) : void
message string The message to display.
Результат void