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.EqualConstraintResult Class Reference

The EqualConstraintResult class is tailored for formatting and displaying the result of an EqualConstraint. More...

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

Public Member Functions

 EqualConstraintResult (EqualConstraint constraint, object actual, bool hasSucceeded)
 Construct an EqualConstraintResult More...
 
override void WriteMessageTo (MessageWriter writer)
 Write a failure message. Overridden to provide custom failure messages for EqualConstraint. More...
 
- Public Member Functions inherited from NUnit.Framework.Constraints.ConstraintResult
 ConstraintResult (IConstraint constraint, object actualValue)
 Constructs a ConstraintResult for a particular Constraint. More...
 
 ConstraintResult (IConstraint constraint, object actualValue, ConstraintStatus status)
 Constructs a ConstraintResult for a particular Constraint. More...
 
 ConstraintResult (IConstraint constraint, object actualValue, bool isSuccess)
 Constructs a ConstraintResult for a particular Constraint. More...
 
virtual void WriteActualValueTo (MessageWriter writer)
 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. More...
 

Private Member Functions

void DisplayDifferences (MessageWriter writer, object expected, object actual, int depth)
 
void DisplayStringDifferences (MessageWriter writer, string expected, string actual)
 
void DisplayStreamDifferences (MessageWriter writer, Stream expected, Stream actual, int depth)
 
void DisplayCollectionDifferences (MessageWriter writer, ICollection expected, ICollection actual, int depth)
 Display the failure information for two collections that did not match. More...
 
void DisplayTypesAndSizes (MessageWriter writer, IEnumerable expected, IEnumerable actual, int indent)
 Displays a single line showing the types and sizes of the expected and actual collections or arrays. If both are identical, the value is only shown once. More...
 
void DisplayFailurePoint (MessageWriter writer, IEnumerable expected, IEnumerable actual, NUnitEqualityComparer.FailurePoint failurePoint, int indent)
 Displays a single line showing the point in the expected and actual arrays at which the comparison failed. If the arrays have different structures or dimensions, both _values are shown. More...
 
void DisplayEnumerableDifferences (MessageWriter writer, IEnumerable expected, IEnumerable actual, int depth)
 Display the failure information for two IEnumerables that did not match. More...
 

Static Private Member Functions

static object GetValueFromCollection (ICollection collection, int index)
 

Private Attributes

object expectedValue
 
Tolerance tolerance
 
bool caseInsensitive
 
bool clipStrings
 
IList
< NUnitEqualityComparer.FailurePoint
failurePoints
 

Static Private Attributes

static readonly string StringsDiffer_1
 
static readonly string StringsDiffer_2
 
static readonly string StreamsDiffer_1
 
static readonly string StreamsDiffer_2
 
static readonly string CollectionType_1
 
static readonly string CollectionType_2
 
static readonly string ValuesDiffer_1
 
static readonly string ValuesDiffer_2
 

Additional Inherited Members

- Properties inherited from NUnit.Framework.Constraints.ConstraintResult
object ActualValue [get, private set]
 The actual value that was passed to the Constraint.ApplyTo{TActual}(TActual) method. More...
 
ConstraintStatus Status [get, set]
 Gets and sets the ResultStatus for this result. More...
 
virtual bool IsSuccess [get]
 True if actual value meets the Constraint criteria otherwise false. More...
 
string Name [get, private set]
 Display friendly name of the constraint. More...
 
string Description [get, private set]
 Description of the constraint may be affected by the state the constraint had when Constraint.ApplyTo{TActual}(TActual) was performed against the actual value. More...
 

Detailed Description

The EqualConstraintResult class is tailored for formatting and displaying the result of an EqualConstraint.

Constructor & Destructor Documentation

Member Function Documentation

override void NUnit.Framework.Constraints.EqualConstraintResult.WriteMessageTo ( MessageWriter  writer)
inlinevirtual

Write a failure message. Overridden to provide custom failure messages for EqualConstraint.

Parameters
writerThe MessageWriter to write to

Reimplemented from NUnit.Framework.Constraints.ConstraintResult.

void NUnit.Framework.Constraints.EqualConstraintResult.DisplayDifferences ( MessageWriter  writer,
object  expected,
object  actual,
int  depth 
)
inlineprivate
void NUnit.Framework.Constraints.EqualConstraintResult.DisplayStringDifferences ( MessageWriter  writer,
string  expected,
string  actual 
)
inlineprivate
void NUnit.Framework.Constraints.EqualConstraintResult.DisplayStreamDifferences ( MessageWriter  writer,
Stream  expected,
Stream  actual,
int  depth 
)
inlineprivate
void NUnit.Framework.Constraints.EqualConstraintResult.DisplayCollectionDifferences ( MessageWriter  writer,
ICollection  expected,
ICollection  actual,
int  depth 
)
inlineprivate

Display the failure information for two collections that did not match.

Parameters
writerThe MessageWriter on which to display
expectedThe expected collection.
actualThe actual collection
depthThe depth of this failure in a set of nested collections
void NUnit.Framework.Constraints.EqualConstraintResult.DisplayTypesAndSizes ( MessageWriter  writer,
IEnumerable  expected,
IEnumerable  actual,
int  indent 
)
inlineprivate

Displays a single line showing the types and sizes of the expected and actual collections or arrays. If both are identical, the value is only shown once.

Parameters
writerThe MessageWriter on which to display
expectedThe expected collection or array
actualThe actual collection or array
indentThe indentation level for the message line

References NUnit.Framework.Constraints.MessageWriter.WriteMessageLine().

void NUnit.Framework.Constraints.EqualConstraintResult.DisplayFailurePoint ( MessageWriter  writer,
IEnumerable  expected,
IEnumerable  actual,
NUnitEqualityComparer.FailurePoint  failurePoint,
int  indent 
)
inlineprivate

Displays a single line showing the point in the expected and actual arrays at which the comparison failed. If the arrays have different structures or dimensions, both _values are shown.

Parameters
writerThe MessageWriter on which to display
expectedThe expected array
actualThe actual array
failurePointIndex of the failure point in the underlying collections
indentThe indentation level for the message line

References NUnit.Framework.Constraints.MessageWriter.WriteMessageLine().

static object NUnit.Framework.Constraints.EqualConstraintResult.GetValueFromCollection ( ICollection  collection,
int  index 
)
inlinestaticprivate
void NUnit.Framework.Constraints.EqualConstraintResult.DisplayEnumerableDifferences ( MessageWriter  writer,
IEnumerable  expected,
IEnumerable  actual,
int  depth 
)
inlineprivate

Display the failure information for two IEnumerables that did not match.

Parameters
writerThe MessageWriter on which to display
expectedThe expected enumeration.
actualThe actual enumeration
depthThe depth of this failure in a set of nested collections

Member Data Documentation

object NUnit.Framework.Constraints.EqualConstraintResult.expectedValue
private
Tolerance NUnit.Framework.Constraints.EqualConstraintResult.tolerance
private
bool NUnit.Framework.Constraints.EqualConstraintResult.caseInsensitive
private
bool NUnit.Framework.Constraints.EqualConstraintResult.clipStrings
private
IList<NUnitEqualityComparer.FailurePoint> NUnit.Framework.Constraints.EqualConstraintResult.failurePoints
private
readonly string NUnit.Framework.Constraints.EqualConstraintResult.StringsDiffer_1
staticprivate
Initial value:
=
"String lengths are both {0}. Strings differ at index {1}."
readonly string NUnit.Framework.Constraints.EqualConstraintResult.StringsDiffer_2
staticprivate
Initial value:
=
"Expected string length {0} but was {1}. Strings differ at index {2}."
readonly string NUnit.Framework.Constraints.EqualConstraintResult.StreamsDiffer_1
staticprivate
Initial value:
=
"Stream lengths are both {0}. Streams differ at offset {1}."
readonly string NUnit.Framework.Constraints.EqualConstraintResult.StreamsDiffer_2
staticprivate
Initial value:
=
"Expected Stream length {0} but was {1}."
readonly string NUnit.Framework.Constraints.EqualConstraintResult.CollectionType_1
staticprivate
Initial value:
=
"Expected and actual are both {0}"
readonly string NUnit.Framework.Constraints.EqualConstraintResult.CollectionType_2
staticprivate
Initial value:
=
"Expected is {0}, actual is {1}"
readonly string NUnit.Framework.Constraints.EqualConstraintResult.ValuesDiffer_1
staticprivate
Initial value:
=
"Values differ at index {0}"
readonly string NUnit.Framework.Constraints.EqualConstraintResult.ValuesDiffer_2
staticprivate
Initial value:
=
"Values differ at expected index {0}, actual index {1}"

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