C# Class UnityEngine.NUnit.Framework.TextMessageWriter

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.
Inheritance: UnityEngine.NUnit.Framework.Constraints.MessageWriter
Show file Open project: Unity-Technologies/nunitv2

Public Properties

Property Type Description
Pfx_Actual string
Pfx_Expected string
PrefixLength int

Public Methods

Method Description
DisplayDifferences ( Constraint constraint ) : void

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.

DisplayDifferences ( object expected, object actual ) : void

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.

DisplayDifferences ( object expected, object actual, Tolerance tolerance ) : void

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

DisplayStringDifferences ( string expected, string actual, int mismatch, bool ignoreCase, bool clipping ) : void

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.

TextMessageWriter ( ) : System

Construct a TextMessageWriter

TextMessageWriter ( string userMessage ) : System

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

WriteActualValue ( object actual ) : void

Writes the text for an actual value.

WriteCollectionElements ( IEnumerable collection, int start, int max ) : void

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

WriteConnector ( string connector ) : void

Writes the text for a connector.

WriteExpectedValue ( object expected ) : void

Writes the text for an expected value.

WriteMessageLine ( int level, string message ) : void

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

WriteModifier ( string modifier ) : void

Write the text for a modifier.

WritePredicate ( string predicate ) : void

Writes the text for a predicate.

WriteValue ( object val ) : void

Writes the text for a generalized value.

Private Methods

Method Description
WriteActualLine ( Constraint constraint ) : void

Write the generic 'Actual' line for a constraint

WriteActualLine ( object actual ) : void

Write the generic 'Actual' line for a given value

WriteArray ( Array array ) : void
WriteCaretLine ( int mismatch ) : void
WriteChar ( char c ) : void
WriteDateTime ( System.DateTime dt ) : void
WriteDecimal ( Decimal d ) : void
WriteDouble ( double d ) : void
WriteExpectedLine ( Constraint constraint ) : void

Write the generic 'Expected' line for a constraint

WriteExpectedLine ( object expected ) : void

Write the generic 'Expected' line for a given value

WriteExpectedLine ( object expected, Tolerance tolerance ) : void

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

WriteFloat ( float f ) : void
WriteString ( string s ) : void

Method Details

DisplayDifferences() public method

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.
public DisplayDifferences ( Constraint constraint ) : void
constraint Constraint The constraint that failed
return void

DisplayDifferences() public method

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.
public DisplayDifferences ( object expected, object actual ) : void
expected object The expected value
actual object The actual value causing the failure
return void

DisplayDifferences() public method

Display Expected and Actual lines for given values, including a tolerance value on the expected line.
public DisplayDifferences ( object expected, object actual, Tolerance tolerance ) : void
expected object The expected value
actual object The actual value causing the failure
tolerance UnityEngine.NUnit.Framework.Constraints.Tolerance The tolerance within which the test was made
return void

DisplayStringDifferences() public method

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.
public DisplayStringDifferences ( string expected, string actual, int mismatch, bool ignoreCase, bool clipping ) : void
expected string The expected string value
actual string The actual string value
mismatch int The point at which the strings don't match or -1
ignoreCase bool If true, case is ignored in string comparisons
clipping bool If true, clip the strings to fit the max line length
return void

TextMessageWriter() public method

Construct a TextMessageWriter
public TextMessageWriter ( ) : System
return System

TextMessageWriter() public method

Construct a TextMessageWriter, specifying a user message and optional formatting arguments.
public TextMessageWriter ( string userMessage ) : System
userMessage string
return System

WriteActualValue() public method

Writes the text for an actual value.
public WriteActualValue ( object actual ) : void
actual object The actual value.
return void

WriteCollectionElements() public method

Writes the text for a collection value, starting at a particular point, to a max length
public WriteCollectionElements ( IEnumerable collection, int start, int max ) : void
collection IEnumerable The collection containing elements to write.
start int The starting point of the elements to write
max int The maximum number of elements to write
return void

WriteConnector() public method

Writes the text for a connector.
public WriteConnector ( string connector ) : void
connector string The connector.
return void

WriteExpectedValue() public method

Writes the text for an expected value.
public WriteExpectedValue ( object expected ) : void
expected object The expected value.
return void

WriteMessageLine() public method

Method to write single line message with optional args, usually written to precede the general failure message, at a givel indentation level.
public WriteMessageLine ( int level, string message ) : void
level int The indentation level of the message
message string The message to be written
return void

WriteModifier() public method

Write the text for a modifier.
public WriteModifier ( string modifier ) : void
modifier string The modifier.
return void

WritePredicate() public method

Writes the text for a predicate.
public WritePredicate ( string predicate ) : void
predicate string The predicate.
return void

WriteValue() public method

Writes the text for a generalized value.
public WriteValue ( object val ) : void
val object The value.
return void

Property Details

Pfx_Actual public static property

Prefix used for the actual value line of a message
public static string Pfx_Actual
return string

Pfx_Expected public static property

Prefix used for the expected value line of a message
public static string Pfx_Expected
return string

PrefixLength public static property

Length of a message prefix
public static int PrefixLength
return int