Table of Contents

Class ThrowsExceptionConstraint

Namespace
NUnit.Framework.Constraints
Assembly
nunit.framework.dll

ThrowsExceptionConstraint tests that an exception has been thrown, without any further tests.

public class ThrowsExceptionConstraint : Constraint, IConstraint, IResolveConstraint
Inheritance
ThrowsExceptionConstraint
Implements
Inherited Members

Constructors

ThrowsExceptionConstraint()

public ThrowsExceptionConstraint()

Properties

Description

The Description of what this constraint tests, for use in messages and in the ConstraintResult.

public override string Description { get; }

Property Value

string

Methods

ApplyTo<TActual>(TActual)

Executes the code and returns success if an exception is thrown.

public override ConstraintResult ApplyTo<TActual>(TActual actual)

Parameters

actual TActual

A delegate representing the code to be tested

Returns

ConstraintResult

True if an exception is thrown, otherwise false

Type Parameters

TActual