TestConsoleExtensions Class
Provides extension methods for working with
TestConsole
in a testing context,
including stack trace normalization for consistent and deterministic test output.
Contains extensions for TestConsole
.
public static class TestConsoleExtensions
- Namespace
- Spectre
.Console .Testing
Methods
-
static TestConsole Colors
(TestConsole, ColorSystem) - Sets the console's color system.
-
static TestConsole EmitAnsiSequences
(TestConsole) - Turns on emitting of VT/ANSI sequences.
-
static TestConsole Height
(TestConsole, int) - Sets the console height.
-
static TestConsole Interactive
(TestConsole) - Makes the console interactive.
-
static string NormalizeStackTrace
(string) - Normalizes a stack trace string by replacing line numbers with ":nn" and converting full file paths to a fixed placeholder path ("/xyz/filename.cs").
-
static TestConsole Size
(TestConsole, Size) - Sets the console size.
-
static TestConsole SupportsAnsi
(TestConsole, bool) - Sets whether or not ANSI is supported.
-
static TestConsole Width
(TestConsole, int) - Sets the console width.
-
static string Write
Normalized Exception (TestConsole, Exception, ExceptionFormats) -
Writes the given exception to the
TestConsole
and returns a normalized string representation of the exception, with file paths and line numbers sanitized.