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.Internal.TextMessageWriter Class Reference

TextMessageWriter writes constraint descriptions and messages in displayable form as a text stream. It tailors the display of individual message components to form the standard message format of NUnit assertion failure messages. More...

+ Inheritance diagram for NUnit.Framework.Internal.TextMessageWriter:
+ Collaboration diagram for NUnit.Framework.Internal.TextMessageWriter:

Public Member Functions

 TextMessageWriter ()
 Construct a TextMessageWriter More...
 
 TextMessageWriter (string userMessage, params object[] args)
 Construct a TextMessageWriter, specifying a user message and optional formatting arguments. More...
 
override void WriteMessageLine (int level, string message, params object[] args)
 Method to write single line message with optional args, usually written to precede the general failure message, at a given indentation level. More...
 
override void DisplayDifferences (ConstraintResult result)
 Display Expected and Actual lines for a constraint. This is called by MessageWriter's default implementation of WriteMessageTo and provides the generic two-line display. More...
 
override void DisplayDifferences (object expected, object actual)
 Display Expected and Actual lines for given _values. This method may be called by constraints that need more control over the display of actual and expected _values than is provided by the default implementation. More...
 
override void DisplayDifferences (object expected, object actual, Tolerance tolerance)
 Display Expected and Actual lines for given _values, including a tolerance value on the expected line. More...
 
override void DisplayStringDifferences (string expected, string actual, int mismatch, bool ignoreCase, bool clipping)
 Display the expected and actual string _values on separate lines. If the mismatch parameter is >=0, an additional line is displayed line containing a caret that points to the mismatch point. More...
 
override void WriteActualValue (object actual)
 Writes the text for an actual value. More...
 
override void WriteValue (object val)
 Writes the text for a generalized value. More...
 
override void WriteCollectionElements (IEnumerable collection, long start, int max)
 Writes the text for a collection value, starting at a particular point, to a max length More...
 
- Public Member Functions inherited from NUnit.Framework.Constraints.MessageWriter
void WriteMessageLine (string message, params object[] args)
 Method to write single line message with optional args, usually written to precede the general failure message. More...
 

Static Public Attributes

static readonly string Pfx_Expected = " Expected: "
 Prefix used for the expected value line of a message More...
 
static readonly string Pfx_Actual = " But was: "
 Prefix used for the actual value line of a message More...
 
static readonly int PrefixLength = Pfx_Expected.Length
 Length of a message prefix More...
 

Properties

override int MaxLineLength [get, set]
 Gets or sets the maximum line length for this writer More...
 
- Properties inherited from NUnit.Framework.Constraints.MessageWriter
abstract int MaxLineLength [get, set]
 Abstract method to get the max line length More...
 

Private Member Functions

void WriteExpectedLine (ConstraintResult result)
 Write the generic 'Expected' line for a constraint More...
 
void WriteExpectedLine (object expected)
 Write the generic 'Expected' line for a given value More...
 
void WriteExpectedLine (object expected, Tolerance tolerance)
 Write the generic 'Expected' line for a given value and tolerance. More...
 
void WriteActualLine (ConstraintResult result)
 Write the generic 'Actual' line for a constraint More...
 
void WriteActualLine (object actual)
 Write the generic 'Actual' line for a given value More...
 
void WriteCaretLine (int mismatch)
 

Private Attributes

int maxLineLength = DEFAULT_LINE_LENGTH
 

Static Private Attributes

static readonly int DEFAULT_LINE_LENGTH = 78
 

Additional Inherited Members

- Protected Member Functions inherited from NUnit.Framework.Constraints.MessageWriter
 MessageWriter ()
 Construct a MessageWriter given a culture More...
 

Detailed Description

TextMessageWriter writes constraint descriptions and messages in displayable form as a text stream. It tailors the display of individual message components to form the standard message format of NUnit assertion failure messages.

Constructor & Destructor Documentation

NUnit.Framework.Internal.TextMessageWriter.TextMessageWriter ( )
inline

Construct a TextMessageWriter

NUnit.Framework.Internal.TextMessageWriter.TextMessageWriter ( string  userMessage,
params object[]  args 
)
inline

Construct a TextMessageWriter, specifying a user message and optional formatting arguments.

Parameters
userMessage
args

Member Function Documentation

override void NUnit.Framework.Internal.TextMessageWriter.WriteMessageLine ( int  level,
string  message,
params object[]  args 
)
inlinevirtual

Method to write single line message with optional args, usually written to precede the general failure message, at a given indentation level.

Parameters
levelThe indentation level of the message
messageThe message to be written
argsAny arguments used in formatting the message

Implements NUnit.Framework.Constraints.MessageWriter.

Referenced by NUnit.Framework.Internal.TextMessageWriterTests.WriteMessageLine_EmbeddedZeroes(), and NUnit.Framework.Internal.TextMessageWriterTests.WriteMessageLine_EmbeddedZeroesAsArgs().

override void NUnit.Framework.Internal.TextMessageWriter.DisplayDifferences ( ConstraintResult  result)
inlinevirtual

Display Expected and Actual lines for a constraint. This is called by MessageWriter's default implementation of WriteMessageTo and provides the generic two-line display.

Parameters
resultThe result of the constraint that failed

Implements NUnit.Framework.Constraints.MessageWriter.

override void NUnit.Framework.Internal.TextMessageWriter.DisplayDifferences ( object  expected,
object  actual 
)
inlinevirtual

Display Expected and Actual lines for given _values. This method may be called by constraints that need more control over the display of actual and expected _values than is provided by the default implementation.

Parameters
expectedThe expected value
actualThe actual value causing the failure

Implements NUnit.Framework.Constraints.MessageWriter.

override void NUnit.Framework.Internal.TextMessageWriter.DisplayDifferences ( object  expected,
object  actual,
Tolerance  tolerance 
)
inlinevirtual

Display Expected and Actual lines for given _values, including a tolerance value on the expected line.

Parameters
expectedThe expected value
actualThe actual value causing the failure
toleranceThe tolerance within which the test was made

Implements NUnit.Framework.Constraints.MessageWriter.

override void NUnit.Framework.Internal.TextMessageWriter.DisplayStringDifferences ( string  expected,
string  actual,
int  mismatch,
bool  ignoreCase,
bool  clipping 
)
inlinevirtual

Display the expected and actual string _values on separate lines. If the mismatch parameter is >=0, an additional line is displayed line containing a caret that points to the mismatch point.

Parameters
expectedThe expected string value
actualThe actual string value
mismatchThe point at which the strings don't match or -1
ignoreCaseIf true, case is ignored in string comparisons
clippingIf true, clip the strings to fit the max line length

Implements NUnit.Framework.Constraints.MessageWriter.

Referenced by NUnit.Framework.Internal.TextMessageWriterTests.DisplayStringDifferences(), and NUnit.Framework.Internal.TextMessageWriterTests.DisplayStringDifferences_NoClipping().

override void NUnit.Framework.Internal.TextMessageWriter.WriteActualValue ( object  actual)
inlinevirtual

Writes the text for an actual value.

Parameters
actualThe actual value.

Implements NUnit.Framework.Constraints.MessageWriter.

override void NUnit.Framework.Internal.TextMessageWriter.WriteValue ( object  val)
inlinevirtual

Writes the text for a generalized value.

Parameters
valThe value.

Implements NUnit.Framework.Constraints.MessageWriter.

override void NUnit.Framework.Internal.TextMessageWriter.WriteCollectionElements ( IEnumerable  collection,
long  start,
int  max 
)
inlinevirtual

Writes the text for a collection value, starting at a particular point, to a max length

Parameters
collectionThe collection containing elements to write.
startThe starting point of the elements to write
maxThe maximum number of elements to write

Implements NUnit.Framework.Constraints.MessageWriter.

void NUnit.Framework.Internal.TextMessageWriter.WriteExpectedLine ( ConstraintResult  result)
inlineprivate

Write the generic 'Expected' line for a constraint

Parameters
resultThe constraint that failed
void NUnit.Framework.Internal.TextMessageWriter.WriteExpectedLine ( object  expected)
inlineprivate

Write the generic 'Expected' line for a given value

Parameters
expectedThe expected value
void NUnit.Framework.Internal.TextMessageWriter.WriteExpectedLine ( object  expected,
Tolerance  tolerance 
)
inlineprivate

Write the generic 'Expected' line for a given value and tolerance.

Parameters
expectedThe expected value
toleranceThe tolerance within which the test was made

References NUnit.Framework.Constraints.Tolerance.IsUnsetOrDefault, NUnit.Framework.Constraints.Tolerance.Mode, and NUnit.Framework.Constraints.Tolerance.Value.

void NUnit.Framework.Internal.TextMessageWriter.WriteActualLine ( ConstraintResult  result)
inlineprivate

Write the generic 'Actual' line for a constraint

Parameters
resultThe ConstraintResult for which the actual value is to be written

References NUnit.Framework.Constraints.ConstraintResult.WriteActualValueTo().

void NUnit.Framework.Internal.TextMessageWriter.WriteActualLine ( object  actual)
inlineprivate

Write the generic 'Actual' line for a given value

Parameters
actualThe actual value causing a failure
void NUnit.Framework.Internal.TextMessageWriter.WriteCaretLine ( int  mismatch)
inlineprivate

Member Data Documentation

readonly int NUnit.Framework.Internal.TextMessageWriter.DEFAULT_LINE_LENGTH = 78
staticprivate
readonly string NUnit.Framework.Internal.TextMessageWriter.Pfx_Expected = " Expected: "
static

Prefix used for the expected value line of a message

Referenced by NUnit.Framework.Constraints.AllItemsConstraintTests.AllItemsAreInRangeFailureMessage(), NUnit.Framework.Constraints.AllItemsConstraintTests.AllItemsAreInstancesOfTypeFailureMessage(), NUnit.Framework.Constraints.AllItemsConstraintTests.AllItemsAreNotNullFails(), NUnit.Framework.Assertions.ArrayEqualsFailureMessageFixture.ArraysWithDifferentDimensionsAsCollection(), NUnit.Framework.Assertions.ArrayEqualsFailureMessageFixture.ArraysWithDifferentRanksAsCollection(), NUnit.Framework.Assertions.StringAssertTests.CaseInsensitiveCompareFails(), NUnit.Framework.Assertions.StringAssertTests.ContainsFails(), NUnit.Framework.Internal.TextMessageWriterTests.DisplayStringDifferences(), NUnit.Framework.Internal.TextMessageWriterTests.DisplayStringDifferences_NoClipping(), NUnit.Framework.Assertions.ArrayEqualsFailureMessageFixture.DoubleDimensionedArrays(), NUnit.Framework.Assertions.StringAssertTests.EndsWithFails(), NUnit.Framework.Constraints.ExactCountConstraintTests.ExactlyOneItemMatchFails(), NUnit.Framework.Constraints.ExactCountConstraintTests.ExactlyTwoItemsMatchFails(), NUnit.Framework.Constraints.ConstraintTestBase.FailsWithBadValues(), NUnit.Framework.Constraints.ThrowsConstraintTestBase.FailsWithBadValues(), NUnit.Framework.Constraints.CollectionEqualsTests.FailureMatchingArrayAndCollection(), NUnit.Framework.Assertions.LessFixture.FailureMessage(), NUnit.Framework.Assertions.GreaterEqualFixture.FailureMessage(), NUnit.Framework.Assertions.ArrayEqualsFailureMessageFixture.FailureOnSingleDimensionedArrays(), NUnit.Framework.Assertions.ArrayEqualsFailureMessageFixture.FiveDimensionedArrays(), NUnit.Framework.Assertions.StringAssertTests.IsMatchFails(), NUnit.Framework.Assertions.ArrayEqualsFailureMessageFixture.JaggedArrayComparedToSimpleArray(), NUnit.Framework.Assertions.ArrayEqualsFailureMessageFixture.JaggedArrays(), NUnit.Framework.Assertions.StringAssertTests.StartsWithFails(), NUnit.Framework.Assertions.ArrayEqualsFailureMessageFixture.TripleDimensionedArrays(), and NUnit.Framework.Constraints.ExactCountConstraintTests.ZeroItemsMatchFails().

readonly string NUnit.Framework.Internal.TextMessageWriter.Pfx_Actual = " But was: "
static

Prefix used for the actual value line of a message

Referenced by NUnit.Framework.Constraints.AllItemsConstraintTests.AllItemsAreInRangeFailureMessage(), NUnit.Framework.Constraints.AllItemsConstraintTests.AllItemsAreInstancesOfTypeFailureMessage(), NUnit.Framework.Constraints.AllItemsConstraintTests.AllItemsAreNotNullFails(), NUnit.Framework.Assertions.ArrayEqualsFailureMessageFixture.ArraysWithDifferentDimensionsAsCollection(), NUnit.Framework.Assertions.ArrayEqualsFailureMessageFixture.ArraysWithDifferentRanksAsCollection(), NUnit.Framework.Assertions.StringAssertTests.CaseInsensitiveCompareFails(), NUnit.Framework.Assertions.StringAssertTests.ContainsFails(), NUnit.Framework.Internal.TextMessageWriterTests.DisplayStringDifferences(), NUnit.Framework.Internal.TextMessageWriterTests.DisplayStringDifferences_NoClipping(), NUnit.Framework.Assertions.ArrayEqualsFailureMessageFixture.DoubleDimensionedArrays(), NUnit.Framework.Assertions.StringAssertTests.EndsWithFails(), NUnit.Framework.Constraints.ExactCountConstraintTests.ExactlyOneItemMatchFails(), NUnit.Framework.Constraints.ExactCountConstraintTests.ExactlyTwoItemsMatchFails(), NUnit.Framework.Constraints.ConstraintTestBase.FailsWithBadValues(), NUnit.Framework.Constraints.ThrowsConstraintTestBase.FailsWithBadValues(), NUnit.Framework.Constraints.CollectionEqualsTests.FailureMatchingArrayAndCollection(), NUnit.Framework.Assertions.LessFixture.FailureMessage(), NUnit.Framework.Assertions.GreaterEqualFixture.FailureMessage(), NUnit.Framework.Assertions.ArrayEqualsFailureMessageFixture.FailureOnSingleDimensionedArrays(), NUnit.Framework.Assertions.ArrayEqualsFailureMessageFixture.FiveDimensionedArrays(), NUnit.Framework.Assertions.StringAssertTests.IsMatchFails(), NUnit.Framework.Assertions.ArrayEqualsFailureMessageFixture.JaggedArrayComparedToSimpleArray(), NUnit.Framework.Assertions.ArrayEqualsFailureMessageFixture.JaggedArrays(), NUnit.Framework.Assertions.StringAssertTests.StartsWithFails(), NUnit.Framework.Assertions.ArrayEqualsFailureMessageFixture.TripleDimensionedArrays(), and NUnit.Framework.Constraints.ExactCountConstraintTests.ZeroItemsMatchFails().

readonly int NUnit.Framework.Internal.TextMessageWriter.PrefixLength = Pfx_Expected.Length
static

Length of a message prefix

int NUnit.Framework.Internal.TextMessageWriter.maxLineLength = DEFAULT_LINE_LENGTH
private

Property Documentation

override int NUnit.Framework.Internal.TextMessageWriter.MaxLineLength
getset

Gets or sets the maximum line length for this writer


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