Skip to content
ConsoleMonster

API Reference

Class

TestRunText

Namespace ConsoleMonster.TestRuns
Assembly ConsoleMonster
Modifiers static

The text of a test run, shared by the live view, the summary and the stream lines, so a failure reads the same everywhere: the status symbol, the blocks and test name joined by the breadcrumb chevron, expected against actual (or the message), and the file and line as a link.

Inheritance

  • Object
  • TestRunText

Methods

public static String FailureLine(TestRecord record, IGlyphSet glyphs) #
Returns: String

One line for a failure in stream output: symbol, path, the first message line or expected and actual, and the location.

Parameters

record ConsoleMonster.TestRuns.TestRecord requiredposition: 0
The failure.
glyphs ConsoleMonster.Glyphs.IGlyphSet requiredposition: 1
The glyph set.

Returns

The line (plain text).

public static List<StyledLine> FailureLines(TestRecord record, RenderContext context, Int32 messageLines = 3) #
Returns: List<StyledLine>

The lines of one failure: the symbol and path, expected and actual (the characters of the actual value that differ are underlined) or up to messageLines lines of the message, and the location as a link.

Parameters

record ConsoleMonster.TestRuns.TestRecord requiredposition: 0
The failure.
context ConsoleMonster.Canvas.RenderContext requiredposition: 1
The render context.
messageLines System.Int32 = 3 optionalposition: 2
The most message lines to show.

Returns

The lines.

public static String? Location(TestRecord record) #
Returns: String?

The location as "file:line" (the file name only), or null when the file is unknown.

Parameters

record ConsoleMonster.TestRuns.TestRecord requiredposition: 0
The record.

Returns

The text.

public static String Outcome(StatusKind status) #
Returns: String

The outcome words for a run status (Tests failed, Tests inconclusive, Tests passed), translated.

Parameters

status ConsoleMonster.Styling.StatusKind requiredposition: 0
The run status.

Returns

The words.

public static String Path(IReadOnlyList<String> blocks, String name, IGlyphSet glyphs) #
Returns: String

The blocks and the test name joined by the breadcrumb separator (› or >).

Parameters

blocks System.Collections.Generic.IReadOnlyList<System.String> requiredposition: 0
The blocks.
name System.String requiredposition: 1
The test name.
glyphs ConsoleMonster.Glyphs.IGlyphSet requiredposition: 2
The glyph set.

Returns

The path.

public static String SummaryLine(TestRunSnapshot snapshot, IGlyphSet glyphs) #
Returns: String

The closing line for stream output: the status symbol, the outcome and the totals.

Parameters

snapshot ConsoleMonster.TestRuns.TestRunSnapshot requiredposition: 0
The snapshot.
glyphs ConsoleMonster.Glyphs.IGlyphSet requiredposition: 1
The glyph set.

Returns

The line (plain text).

public static String Totals(TestRunSnapshot snapshot, IGlyphSet glyphs, Boolean clock = true) #
Returns: String

The run totals: "3 failed · 3 passed · 1 skipped · 7 tests · 00:00:01" (separators per tier).

Parameters

snapshot ConsoleMonster.TestRuns.TestRunSnapshot requiredposition: 0
The snapshot.
glyphs ConsoleMonster.Glyphs.IGlyphSet requiredposition: 1
The glyph set.
clock System.Boolean = true optionalposition: 2
Whether to end with the run clock.

Returns

The facts.

public static Boolean TryParseExpectation(String? message, out String expected, out String actual) #
Returns: Boolean

Reads expected and actual values from an assertion message ("Expected 4, but got 3.", or the "Expected:" and "But was:" lines of a string comparison). Quotes around both values are removed.

Parameters

message System.String? requiredposition: 0
The message.
expected System.String requiredposition: 1
The expected value.
actual System.String requiredposition: 2
The actual value.

Returns

Whether both were found.