IGLib  1.7.2
The IGLib base library EXTENDED - with other lilbraries and applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
NUnit.Framework.Constraints.ThrowsConstraint Class Reference

ThrowsConstraint is used to test the exception thrown by a delegate by applying a constraint to it. More...

+ Inheritance diagram for NUnit.Framework.Constraints.ThrowsConstraint:
+ Collaboration diagram for NUnit.Framework.Constraints.ThrowsConstraint:

Classes

class  ExceptionInterceptor
 
class  GenericInvocationDescriptor< T >
 
interface  IInvocationDescriptor
 
class  ThrowsConstraintResult
 
class  VoidInvocationDescriptor
 

Public Member Functions

 ThrowsConstraint (IConstraint baseConstraint)
 Initializes a new instance of the ThrowsConstraint class, using a constraint to be applied to the exception. More...
 
override ConstraintResult ApplyTo< TActual > (TActual actual)
 Executes the code of the delegate and captures any exception. If a non-null base constraint was provided, it applies that constraint to the exception. More...
 
override ConstraintResult ApplyTo< TActual > (ActualValueDelegate< TActual > del)
 Converts an ActualValueDelegate to a TestDelegate before calling the primary overload. More...
 
- Public Member Functions inherited from NUnit.Framework.Constraints.Constraint
virtual ConstraintResult ApplyTo< TActual > (ref TActual actual)
 Test whether the constraint is satisfied by a given reference. The default implementation simply dereferences the value but derived classes may override it to provide for delayed processing. More...
 
override string ToString ()
 Default override of ToString returns the constraint DisplayName followed by any arguments within angle brackets. More...
 
DelayedConstraint After (int delayInMilliseconds)
 Returns a DelayedConstraint with the specified delay time. More...
 
DelayedConstraint After (int delayInMilliseconds, int pollingInterval)
 Returns a DelayedConstraint with the specified delay time and polling interval. More...
 

Properties

Exception ActualException [get]
 Get the actual exception thrown - used by Assert.Throws. More...
 
override string Description [get]
 Gets text describing a constraint More...
 
- Properties inherited from NUnit.Framework.Constraints.PrefixConstraint
override string Description [get]
 The Description of what this constraint tests, for use in messages and in the ConstraintResult. More...
 
- Properties inherited from NUnit.Framework.Constraints.Constraint
string DisplayName [get, protected set]
 The display name of this Constraint for use by ToString(). The default value is the name of the constraint with trailing "Constraint" removed. Derived classes may set this to another name in their constructors. More...
 
virtual string Description [get, protected set]
 The Description of what this constraint tests, for use in messages and in the ConstraintResult. More...
 
object[] Arguments [get, private set]
 Arguments provided to this Constraint, for use in formatting the description. More...
 
ConstraintBuilder Builder [get, set]
 The ConstraintBuilder holding this constraint More...
 
ConstraintExpression And [get]
 Returns a ConstraintExpression by appending And to the current constraint. More...
 
ConstraintExpression With [get]
 Returns a ConstraintExpression by appending And to the current constraint. More...
 
ConstraintExpression Or [get]
 Returns a ConstraintExpression by appending Or to the current constraint. More...
 
- Properties inherited from NUnit.Framework.Constraints.IConstraint
string DisplayName [get]
 The display name of this Constraint for use by ToString(). More...
 
string Description [get]
 The Description of what this constraint tests, for use in messages and in the ConstraintResult. More...
 
object[] Arguments [get]
 Arguments provided to this Constraint, for use in formatting the description. More...
 
ConstraintBuilder Builder [get, set]
 The ConstraintBuilder holding this constraint More...
 

Private Attributes

Exception caughtException
 

Additional Inherited Members

- Static Public Member Functions inherited from NUnit.Framework.Constraints.Constraint
static Constraint operator& (Constraint left, Constraint right)
 This operator creates a constraint that is satisfied only if both argument constraints are satisfied. More...
 
static Constraint operator| (Constraint left, Constraint right)
 This operator creates a constraint that is satisfied if either of the argument constraints is satisfied. More...
 
static Constraint operator! (Constraint constraint)
 This operator creates a constraint that is satisfied if the argument constraint is not satisfied. More...
 
- Protected Member Functions inherited from NUnit.Framework.Constraints.PrefixConstraint
 PrefixConstraint (IResolveConstraint baseConstraint)
 Construct given a base constraint More...
 
- Protected Member Functions inherited from NUnit.Framework.Constraints.Constraint
 Constraint (params object[] args)
 Construct a constraint with optional arguments More...
 
virtual string GetStringRepresentation ()
 Returns the string representation of this constraint More...
 
- Protected Attributes inherited from NUnit.Framework.Constraints.PrefixConstraint
IConstraint baseConstraint
 The base constraint More...
 
string descriptionPrefix
 Prefix used in forming the constraint description More...
 

Detailed Description

ThrowsConstraint is used to test the exception thrown by a delegate by applying a constraint to it.

Constructor & Destructor Documentation

NUnit.Framework.Constraints.ThrowsConstraint.ThrowsConstraint ( IConstraint  baseConstraint)
inline

Initializes a new instance of the ThrowsConstraint class, using a constraint to be applied to the exception.

Parameters
baseConstraintA constraint to apply to the caught exception.

Member Function Documentation

override ConstraintResult NUnit.Framework.Constraints.ThrowsConstraint.ApplyTo< TActual > ( TActual  actual)
inlinevirtual

Executes the code of the delegate and captures any exception. If a non-null base constraint was provided, it applies that constraint to the exception.

Parameters
actualA delegate representing the code to be tested
Returns
True if an exception is thrown and the constraint succeeds, otherwise false

Implements NUnit.Framework.Constraints.Constraint.

override ConstraintResult NUnit.Framework.Constraints.ThrowsConstraint.ApplyTo< TActual > ( ActualValueDelegate< TActual >  del)
inlinevirtual

Converts an ActualValueDelegate to a TestDelegate before calling the primary overload.

Parameters
del
Returns

Reimplemented from NUnit.Framework.Constraints.Constraint.

Member Data Documentation

Exception NUnit.Framework.Constraints.ThrowsConstraint.caughtException
private

Property Documentation

Exception NUnit.Framework.Constraints.ThrowsConstraint.ActualException
get

Get the actual exception thrown - used by Assert.Throws.

override string NUnit.Framework.Constraints.ThrowsConstraint.Description
get

Gets text describing a constraint


The documentation for this class was generated from the following file: