TestimoX

API Reference

Class

ConsoleHelper

Namespace TestimoX

Helper methods for console interaction and logging.

Inheritance

  • Object
  • ConsoleHelper

Methods

CalculateDisplayWidth(System.String arg1) #

Approximates the rendered column width of a string, skipping zero-width joiners and treating emoji/CJK code points as double width.

Parameters

arg1 System.String required
DisplayMessage 2 overloads
DisplayMessage(System.String action, System.String message, Spectre.Console.Color colorAction, Spectre.Console.Color colorMessage, TestimoX.Definitions.TestimoEmoji emoji, System.String divideChar) #

Logs a formatted message including an emoji and colors.

Parameters

action System.String required
Action being executed.
message System.String required
Message to display.
colorAction Spectre.Console.Color required
Color for the action.
colorMessage Spectre.Console.Color required
Color for the message.
emoji TestimoX.Definitions.TestimoEmoji required
Emoji to show.
divideChar System.String required
Optional divider character.
DisplayMessage(System.String message, TestimoX.Definitions.TestimoStatus status, System.Boolean debugMessage) #

Logs a simple message with status coloring.

Parameters

message System.String required
Message to display.
status TestimoX.Definitions.TestimoStatus required
Status of the message.
debugMessage System.Boolean required
Whether the message is debug only.
EnumerateCodePoints(System.String arg1) #

Enumerates Unicode code points from a UTF-16 string without System.Text.Rune (net472 safe).

Parameters

arg1 System.String required
GetEmojiPrefix(TestimoX.Definitions.TestimoEmoji emoji, System.Int32 targetWidth) #

Returns a padded emoji (or ASCII fallback) so that subsequent text starts at a fixed column. Uses display-width calculations instead of raw string length to cope with composite emoji.

Parameters

emoji TestimoX.Definitions.TestimoEmoji required
Emoji to render.
targetWidth System.Int32 required
Desired column width (default 3) for the glyph + padding.
GetSafeWidth() #

Safely obtains the width of the console window.

Returns

The width in characters.

InitializeDisplayLoggingToScreen(System.Threading.CancellationToken cancellationToken) #

Continuously writes log messages to the screen until cancelled.

Parameters

cancellationToken System.Threading.CancellationToken required
Token to cancel logging.
WaitForLogQueueToFinish(System.Threading.CancellationToken cancellationToken) #

Waits until the log queue is fully processed.

Parameters

cancellationToken System.Threading.CancellationToken required
Token to cancel waiting.
WriteMarkupLine(System.String markup) #

Writes a markup line directly to the console, honouring the ForceAscii flag. When ForceAscii is on, all markup tags are stripped prior to writing.

Parameters

markup System.String required
Text containing Spectre.Console markup.
WriteRule(System.String titleMarkup, System.String ruleStyle) #

Renders a horizontal rule/heading in a way that degrades gracefully to plain ASCII.

Parameters

titleMarkup System.String required
Title to display. Can contain Spectre.Console markup.
ruleStyle System.String required
Spectre rule style when ANSI capable.

Properties

IsCI #

Detects if we're running in a CI environment.

IsTestHost #

Detects if we're running inside the .NET test host (e.g., dotnet test).