API Reference
ScriptedInput
Input from a script, for tests, demos and recordings: Down Down Space "ad.evotec" Enter. key names as accepts them (Ctrl+K, Shift+Tab, F2, ?); Down*3 repeats a key; quoted text ("text" or 'text') types each character; paste:"text" pastes; resize:80x24 resizes; wait:250 pauses (milliseconds). Reading past the end throws InputClosedException, so a test whose script is too short fails instead of hanging.
Inheritance
- Object
- ScriptedInput
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
- Method TestTerminal.Keys
Constructors
Methods
public Void Append(String script) #VoidAppends events to the script.
Parameters
- script System.String
- More script.
public Void Dispose() #VoidPerforms application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public static IReadOnlyList<InputEvent> ParseEvents(String script) #IReadOnlyList<InputEvent>Parses a script into events (pauses are dropped).
Parameters
- script System.String
- The script.
Returns
The events.
public InputEvent? Read(TimeSpan timeout, CancellationToken cancellationToken) #InputEvent?Waits up to timeout for the next event.
Parameters
- timeout System.TimeSpan
- The longest wait; TimeSpan.Zero polls.
- cancellationToken System.Threading.CancellationToken
- Cancels the wait with OperationCanceledException.
Returns
The event, or null when the timeout passed without input.
Exceptions
InputClosedException– The input ended (end of a script, closed stdin).
Inherited Methods
public virtual Boolean Equals(Object? obj) #BooleanParameters
- obj Object?
Properties
public String Name { get; } #A short description for diagnostics, for example windows console (ReadConsoleInputW).
public Boolean RealTime { get; set; } #Whether pauses (wait:) really sleep. Off by default so tests run instantly; demos turn it on.
public Boolean Paced { get; set; } #When true, a read that does not wait (zero timeout) returns null, so a reader that drains bursts draws a frame after every scripted event (golden tests of each step).
public Boolean EndsQuietly { get; set; } #When true, reading past the end returns null (a timeout) instead of throwing.