Class Throws
Helper class with properties and methods that supply
constraints that operate on exceptions.
Assembly: nunit.framework.dll
Syntax
public abstract class Throws
Constructors
View Source
Throws()
Declaration
Properties
View Source
ArgumentException
Creates a constraint specifying an expected ArgumentException
Declaration
public static ExactTypeConstraint ArgumentException { get; }
Property Value
View Source
ArgumentNullException
Creates a constraint specifying an expected ArgumentNullException
Declaration
public static ExactTypeConstraint ArgumentNullException { get; }
Property Value
View Source
Exception
Creates a constraint specifying an expected exception
Declaration
public static ResolvableConstraintExpression Exception { get; }
Property Value
View Source
InnerException
Creates a constraint specifying an exception with a given InnerException
Declaration
public static ResolvableConstraintExpression InnerException { get; }
Property Value
View Source
InvalidOperationException
Creates a constraint specifying an expected InvalidOperationException
Declaration
public static ExactTypeConstraint InvalidOperationException { get; }
Property Value
View Source
Nothing
Creates a constraint specifying that no exception is thrown
Declaration
public static ThrowsNothingConstraint Nothing { get; }
Property Value
View Source
TargetInvocationException
Creates a constraint specifying an expected TargetInvocationException
Declaration
public static ExactTypeConstraint TargetInvocationException { get; }
Property Value
Methods
View Source
InstanceOf(Type)
Creates a constraint specifying the type of exception expected
Declaration
public static InstanceOfTypeConstraint InstanceOf(Type expectedType)
Parameters
Type |
Name |
Description |
Type |
expectedType |
|
Returns
View Source
InstanceOf<TExpected>()
Creates a constraint specifying the type of exception expected
Declaration
public static InstanceOfTypeConstraint InstanceOf<TExpected>() where TExpected : Exception
Returns
Type Parameters
Name |
Description |
TExpected |
|
View Source
TypeOf(Type)
Creates a constraint specifying the exact type of exception expected
Declaration
public static ExactTypeConstraint TypeOf(Type expectedType)
Parameters
Type |
Name |
Description |
Type |
expectedType |
|
Returns
View Source
TypeOf<TExpected>()
Creates a constraint specifying the exact type of exception expected
Declaration
public static ExactTypeConstraint TypeOf<TExpected>() where TExpected : Exception
Returns
Type Parameters
Name |
Description |
TExpected |
|