Class TestShell
Test shell that runs the real semi-interactive modal loop against a TestTerminal.
public sealed class TestShell : ICliAppShell
- Inheritance
-
TestShell
- Implements
- Inherited Members
Constructors
TestShell(TestTerminal, int, TigerCliInteractionMode, CultureInfo?, bool)
Creates a test shell over an existing in-memory terminal.
public TestShell(TestTerminal terminal, int viewportHeightPercent = 100, TigerCliInteractionMode interactionMode = TigerCliInteractionMode.SemiInteractive, CultureInfo? culture = null, bool useManualClock = false)
Parameters
terminalTestTerminal- The terminal used to simulate input and capture output.
viewportHeightPercentint- The percentage of terminal height available to the modal viewport.
interactionModeTigerCliInteractionMode- The interaction policy used by the shell.
cultureCultureInfo- The UI culture, or
nullforen-US. useManualClockbool- Whether timeout tests use a manually advanced clock.
TestShell(int, int, int, TigerCliInteractionMode, CultureInfo?, bool)
Creates a test shell with a new in-memory terminal.
public TestShell(int viewportWidth = 80, int viewportHeight = 24, int viewportHeightPercent = 100, TigerCliInteractionMode interactionMode = TigerCliInteractionMode.SemiInteractive, CultureInfo? culture = null, bool useManualClock = false)
Parameters
viewportWidthint- The simulated terminal width in cells.
viewportHeightint- The simulated terminal height in cells.
viewportHeightPercentint- The percentage of terminal height available to the modal viewport.
interactionModeTigerCliInteractionMode- The interaction policy used by the shell.
cultureCultureInfo- The UI culture, or
nullforen-US. useManualClockbool- Whether timeout tests use a manually advanced clock.
Properties
Culture
UI culture used to resolve framework-owned localized strings (Yes/No,
MultiSelect hint, empty-state labels). Defaults to en-US for shells
that do not override it.
public CultureInfo Culture { get; }
Property Value
InteractionMode
The interaction mode that controls whether prompts may display UI.
public TigerCliInteractionMode InteractionMode { get; }
Property Value
IsFullWindow
True when the shell owns the full terminal window rather than an inline region.
public bool IsFullWindow { get; }
Property Value
Terminal
The in-memory terminal used for simulated input and captured rendering.
public TestTerminal Terminal { get; }
Property Value
Theme
The theme used by controls hosted in this shell.
public ITheme Theme { get; }
Property Value
UsesManualClock
True when this shell was created with
useManualClock: true, so the modal
inactivity timeout advances only via AdvanceTime(TimeSpan) rather than the
wall clock. Use this for deterministic timeout/timer-reset tests.public bool UsesManualClock { get; }
Property Value
Viewport
The current viewport available for modal rendering.
public Size Viewport { get; }
Property Value
Methods
AdvanceTime(TimeSpan)
Advances the modal inactivity-timeout clock by
delta of virtual
time. Only the timeout deadline reads this clock; input polling stays real-time, so
combine this with Terminal.WaitForInputDrainedAsync to order key presses and
time advances deterministically. Requires useManualClock: true.public void AdvanceTime(TimeSpan delta)
Parameters
deltaTimeSpan
RaiseSystemCancellation()
Deterministic seam for process/system cancellation: trips the same system-cancellation token a
real Ctrl-C / SIGINT / SIGTERM handler would, so a modal running on this shell completes with
SystemCancel without raising a real OS signal.
public void RaiseSystemCancellation()
RunModalAsync(ICliDialog, TimeSpan?, CancellationToken)
Runs a dialog until it produces a result, the optional timeout expires, or the cancellation
token is cancelled.
public Task<DialogResult> RunModalAsync(ICliDialog dialog, TimeSpan? timeout = null, CancellationToken ct = default)
Parameters
dialogICliDialogtimeoutTimeSpan?ctCancellationToken
Returns
RunModalAsync(ICliDialog, CancellationToken)
Runs a dialog until it produces a result or the cancellation token is cancelled.
public Task<DialogResult> RunModalAsync(ICliDialog dialog, CancellationToken ct = default)
Parameters
dialogICliDialogctCancellationToken