Table of Contents

Class AssertionHelper

Namespace
NUnit.Framework
Assembly
nunit.framework.dll

AssertionHelper is an optional base class for user tests, allowing the use of shorter ids for constraints and asserts and avoiding conflict with the definition of Is, from which it inherits much of its behavior, in certain mock object frameworks.

public class AssertionHelper : ConstraintFactory
Inheritance
AssertionHelper
Inherited Members

Constructors

AssertionHelper()

public AssertionHelper()

Methods

Expect(TestDelegate, IResolveConstraint)

Asserts that the code represented by a delegate throws an exception that satisfies the constraint provided.

public void Expect(TestDelegate code, IResolveConstraint constraint)

Parameters

code TestDelegate

A TestDelegate to be executed

constraint IResolveConstraint

A ThrowsConstraint used in the test

Expect(bool)

Asserts that a condition is true. If the condition is false the method throws an AssertionException. Works Identically to That(bool).

public void Expect(bool condition)

Parameters

condition bool

The evaluated condition

Expect(bool, string)

Asserts that a condition is true. If the condition is false the method throws an AssertionException. Works Identically to That(bool, string).

public void Expect(bool condition, string message)

Parameters

condition bool

The evaluated condition

message string

The message to display if the condition is false

Expect(bool, string, params object[])

Asserts that a condition is true. If the condition is false the method throws an AssertionException. Works Identically to That(bool, string, params object[]).

public void Expect(bool condition, string message, params object[] args)

Parameters

condition bool

The evaluated condition

message string

The message to display if the condition is false

args object[]

Arguments to be used in formatting the message

Expect<TActual>(ActualValueDelegate<TActual>, IResolveConstraint)

Apply a constraint to an actual value, succeeding if the constraint is satisfied and throwing an assertion exception on failure.

public void Expect<TActual>(ActualValueDelegate<TActual> del, IResolveConstraint expr)

Parameters

del ActualValueDelegate<TActual>

An ActualValueDelegate returning the value to be tested

expr IResolveConstraint

A Constraint expression to be applied

Type Parameters

TActual

Expect<TActual>(ActualValueDelegate<TActual>, IResolveConstraint, string)

Apply a constraint to an actual value, succeeding if the constraint is satisfied and throwing an assertion exception on failure.

public void Expect<TActual>(ActualValueDelegate<TActual> del, IResolveConstraint expr, string message)

Parameters

del ActualValueDelegate<TActual>

An ActualValueDelegate returning the value to be tested

expr IResolveConstraint

A Constraint expression to be applied

message string

The message that will be displayed on failure

Type Parameters

TActual

Expect<TActual>(ActualValueDelegate<TActual>, IResolveConstraint, string, params object[])

Apply a constraint to an actual value, succeeding if the constraint is satisfied and throwing an assertion exception on failure.

public void Expect<TActual>(ActualValueDelegate<TActual> del, IResolveConstraint expr, string message, params object[] args)

Parameters

del ActualValueDelegate<TActual>

An ActualValueDelegate returning the value to be tested

expr IResolveConstraint

A Constraint expression to be applied

message string

The message that will be displayed on failure

args object[]

Arguments to be used in formatting the message

Type Parameters

TActual

Expect<TActual>(TActual, IResolveConstraint)

Apply a constraint to an actual value, succeeding if the constraint is satisfied and throwing an assertion exception on failure.

public static void Expect<TActual>(TActual actual, IResolveConstraint expression)

Parameters

actual TActual

The actual value to test

expression IResolveConstraint

A Constraint to be applied

Type Parameters

TActual

Expect<TActual>(TActual, IResolveConstraint, string)

Apply a constraint to an actual value, succeeding if the constraint is satisfied and throwing an assertion exception on failure.

public static void Expect<TActual>(TActual actual, IResolveConstraint expression, string message)

Parameters

actual TActual

The actual value to test

expression IResolveConstraint

A Constraint to be applied

message string

The message that will be displayed on failure

Type Parameters

TActual

Expect<TActual>(TActual, IResolveConstraint, string, params object[])

Apply a constraint to an actual value, succeeding if the constraint is satisfied and throwing an assertion exception on failure.

public static void Expect<TActual>(TActual actual, IResolveConstraint expression, string message, params object[] args)

Parameters

actual TActual

The actual value to test

expression IResolveConstraint

A Constraint expression to be applied

message string

The message that will be displayed on failure

args object[]

Arguments to be used in formatting the message

Type Parameters

TActual

Expect<TActual>(ref TActual, IResolveConstraint)

Apply a constraint to a referenced value, succeeding if the constraint is satisfied and throwing an assertion exception on failure.

public static void Expect<TActual>(ref TActual actual, IResolveConstraint expression)

Parameters

actual TActual

The actual value to test

expression IResolveConstraint

A Constraint to be applied

Type Parameters

TActual

Expect<TActual>(ref TActual, IResolveConstraint, string)

Apply a constraint to a referenced value, succeeding if the constraint is satisfied and throwing an assertion exception on failure.

public static void Expect<TActual>(ref TActual actual, IResolveConstraint expression, string message)

Parameters

actual TActual

The actual value to test

expression IResolveConstraint

A Constraint to be applied

message string

The message that will be displayed on failure

Type Parameters

TActual

Expect<TActual>(ref TActual, IResolveConstraint, string, params object[])

Apply a constraint to a referenced value, succeeding if the constraint is satisfied and throwing an assertion exception on failure.

public static void Expect<TActual>(ref TActual actual, IResolveConstraint expression, string message, params object[] args)

Parameters

actual TActual

The actual value to test

expression IResolveConstraint

A Constraint to be applied

message string

The message that will be displayed on failure

args object[]

Arguments to be used in formatting the message

Type Parameters

TActual

Map(ICollection)

Returns a ListMapper based on a collection.

public ListMapper Map(ICollection original)

Parameters

original ICollection

The original collection

Returns

ListMapper