C# Class PclUnit.Constraints.Pieces.ThrowsConstraint

ThrowsConstraint is used to test the exception thrown by a delegate by applying a constraint to it.
Inheritance: PrefixConstraint
Mostrar archivo Open project: jbtule/PclUnit

Public Methods

Method Description
Matches ( ActualValueDelegate del ) : bool

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

Matches ( object actual ) : bool

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.

ThrowsConstraint ( Constraint baseConstraint ) : System

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

WriteActualValueTo ( MessageWriter writer ) : void

Write the actual value for a failing constraint test to a MessageWriter. The default implementation simply writes the raw value of actual, leaving it to the writer to perform any formatting.

WriteDescriptionTo ( MessageWriter writer ) : void

Write the constraint description to a MessageWriter

Protected Methods

Method Description
GetStringRepresentation ( ) : string

Returns the string representation of this constraint

Method Details

GetStringRepresentation() protected method

Returns the string representation of this constraint
protected GetStringRepresentation ( ) : string
return string

Matches() public method

Converts an ActualValueDelegate to a TestDelegate before calling the primary overload.
public Matches ( ActualValueDelegate del ) : bool
del ActualValueDelegate
return bool

Matches() public method

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.
public Matches ( object actual ) : bool
actual object A delegate representing the code to be tested
return bool

ThrowsConstraint() public method

Initializes a new instance of the T:ThrowsConstraint class, using a constraint to be applied to the exception.
public ThrowsConstraint ( Constraint baseConstraint ) : System
baseConstraint Constraint A constraint to apply to the caught exception.
return System

WriteActualValueTo() public method

Write the actual value for a failing constraint test to a MessageWriter. The default implementation simply writes the raw value of actual, leaving it to the writer to perform any formatting.
public WriteActualValueTo ( MessageWriter writer ) : void
writer MessageWriter The writer on which the actual value is displayed
return void

WriteDescriptionTo() public method

Write the constraint description to a MessageWriter
public WriteDescriptionTo ( MessageWriter writer ) : void
writer MessageWriter The writer on which the description is displayed
return void