Skip to content
ConsoleMonster

API Reference

Class

RecordingTarget

Namespace ConsoleMonster.Output
Assembly ConsoleMonster
Implements
Modifiers sealed

An in-memory target for tests: output collects in RecordingTarget.Text, optional scripted keys answer prompts, and the screens that prompts, menus, forms and grids draw collect in RecordingTarget.Screens. Pair with GoldenFile through RecordingTarget.MatchGolden. Create one with TestTerminal.Target.

Inheritance

  • Object
  • RecordingTarget

Usage

Explore 1 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Returned or exposed by 1

Constructors

public RecordingTarget(TerminalProfile profile, String? keys = null) #

Creates a recording target.

Parameters

profile ConsoleMonster.Capabilities.TerminalProfile requiredposition: 0
The profile (use TestTerminal.Profile for a fixed one).
keys System.String? = null optionalposition: 1
Scripted keys for prompts (see TestTerminal.Keys), or null for no input.

Methods

public Void Clear() #
Returns: Void

Forgets the output written so far.

public Void MatchGolden(String path) #
Returns: Void

Compares RecordingTarget.Text with a golden file (see GoldenFile.Match).

Parameters

path System.String requiredposition: 0
The golden file path.

Properties

public String Name { get; } #

A short description for diagnostics, for example console or recording 80x24.

public TerminalProfile Profile { get; } #

The capability profile for a write happening now (the console's refreshes its size on every call).

public ITheme? Theme { get; set; } #

The theme (default the dark theme).

public ITerminalWriter? Writer { get; } #

The writer that receives the output, or null for the process console. The target owns it: callers write and flush but never dispose it.

public IInputSource? Input { get; } #

The input for prompts, menus and forms, or null. On the console null means the keyboard; on any other target it means nobody can answer, so prompts use their defaults or explain what is missing.

public ScreenCapture Screens { get; } #

The screens drawn by prompts, menus, forms and grids run against this target.

public String Output { get; } #

Everything written so far, exactly as written (including colour codes when the profile has colour).

public String Text { get; } #

The output as plain text: escape sequences removed, line endings normalised to \n.