Table of Contents

Class Throws

Namespace
NUnit.Framework
Assembly
nunit.framework.dll

Helper class with properties and methods that supply constraints that operate on exceptions.

public class Throws
Inheritance
Throws
Inherited Members

Constructors

Throws()

public Throws()

Properties

ArgumentException

Creates a constraint specifying an expected TargetInvocationException

public static ExactTypeConstraint ArgumentException { get; }

Property Value

ExactTypeConstraint

Exception

Creates a constraint specifying an expected exception

public static ResolvableConstraintExpression Exception { get; }

Property Value

ResolvableConstraintExpression

InnerException

Creates a constraint specifying an exception with a given InnerException

public static ResolvableConstraintExpression InnerException { get; }

Property Value

ResolvableConstraintExpression

InvalidOperationException

Creates a constraint specifying an expected TargetInvocationException

public static ExactTypeConstraint InvalidOperationException { get; }

Property Value

ExactTypeConstraint

Nothing

Creates a constraint specifying that no exception is thrown

public static ThrowsNothingConstraint Nothing { get; }

Property Value

ThrowsNothingConstraint

TargetInvocationException

Creates a constraint specifying an expected TargetInvocationException

public static ExactTypeConstraint TargetInvocationException { get; }

Property Value

ExactTypeConstraint

Methods

InstanceOf(Type)

Creates a constraint specifying the type of exception expected

public static InstanceOfTypeConstraint InstanceOf(Type expectedType)

Parameters

expectedType Type

Returns

InstanceOfTypeConstraint

InstanceOf<TExpected>()

Creates a constraint specifying the type of exception expected

public static InstanceOfTypeConstraint InstanceOf<TExpected>()

Returns

InstanceOfTypeConstraint

Type Parameters

TExpected

TypeOf(Type)

Creates a constraint specifying the exact type of exception expected

public static ExactTypeConstraint TypeOf(Type expectedType)

Parameters

expectedType Type

Returns

ExactTypeConstraint

TypeOf<TExpected>()

Creates a constraint specifying the exact type of exception expected

public static ExactTypeConstraint TypeOf<TExpected>()

Returns

ExactTypeConstraint

Type Parameters

TExpected