IGLib
1.7.2
The IGLib base library EXTENDED - with other lilbraries and applications.
|
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...
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... | |
![]() | |
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... | |
![]() | |
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 | |
![]() | |
MessageWriter () | |
Construct a MessageWriter given a culture More... | |
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.
|
inline |
Construct a TextMessageWriter
|
inline |
Construct a TextMessageWriter, specifying a user message and optional formatting arguments.
userMessage | |
args |
|
inlinevirtual |
Method to write single line message with optional args, usually written to precede the general failure message, at a given indentation level.
level | The indentation level of the message |
message | The message to be written |
args | Any 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().
|
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.
result | The result of the constraint that failed |
Implements NUnit.Framework.Constraints.MessageWriter.
|
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.
expected | The expected value |
actual | The actual value causing the failure |
Implements NUnit.Framework.Constraints.MessageWriter.
|
inlinevirtual |
Display Expected and Actual lines for given _values, including a tolerance value on the expected line.
expected | The expected value |
actual | The actual value causing the failure |
tolerance | The tolerance within which the test was made |
Implements NUnit.Framework.Constraints.MessageWriter.
|
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.
expected | The expected string value |
actual | The actual string value |
mismatch | The point at which the strings don't match or -1 |
ignoreCase | If true, case is ignored in string comparisons |
clipping | If 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().
|
inlinevirtual |
Writes the text for an actual value.
actual | The actual value. |
Implements NUnit.Framework.Constraints.MessageWriter.
|
inlinevirtual |
Writes the text for a generalized value.
val | The value. |
Implements NUnit.Framework.Constraints.MessageWriter.
|
inlinevirtual |
Writes the text for a collection value, starting at a particular point, to a max length
collection | The collection containing elements to write. |
start | The starting point of the elements to write |
max | The maximum number of elements to write |
Implements NUnit.Framework.Constraints.MessageWriter.
|
inlineprivate |
Write the generic 'Expected' line for a constraint
result | The constraint that failed |
|
inlineprivate |
Write the generic 'Expected' line for a given value
expected | The expected value |
|
inlineprivate |
Write the generic 'Expected' line for a given value and tolerance.
expected | The expected value |
tolerance | The tolerance within which the test was made |
References NUnit.Framework.Constraints.Tolerance.IsUnsetOrDefault, NUnit.Framework.Constraints.Tolerance.Mode, and NUnit.Framework.Constraints.Tolerance.Value.
|
inlineprivate |
Write the generic 'Actual' line for a constraint
result | The ConstraintResult for which the actual value is to be written |
References NUnit.Framework.Constraints.ConstraintResult.WriteActualValueTo().
|
inlineprivate |
Write the generic 'Actual' line for a given value
actual | The actual value causing a failure |
|
inlineprivate |
|
staticprivate |
|
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().
|
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().
|
static |
Length of a message prefix
|
private |
|
getset |
Gets or sets the maximum line length for this writer