ReplSessionHandle
Handle for a single live in-memory REPL session.
- Kind:
Class - Namespace: Repl.Testing
- Assembly:
Repl.Testing - Source: src/Repl.Testing/ReplSessionHandle.cs
Signature
Section titled “Signature”public sealed class ReplSessionHandle : IAsyncDisposableInheritance
Section titled “Inheritance”Implements
Section titled “Implements”Methods
Section titled “Methods”DisposeAsync()
Section titled “DisposeAsync()”Ends the session, removes it from its host, and releases the session’s dependency-injection
scope — disposing every Scoped service it resolved. Disposing twice is a no-op.
public ValueTask DisposeAsync()Returns
Section titled “Returns”GetSnapshot()
Section titled “GetSnapshot()”Captures the session’s current terminal metadata. Returns Empty(string) when the session has registered none yet, so this never returns null.
public SessionSnapshot GetSnapshot()Returns
Section titled “Returns”SessionSnapshot - A snapshot of this session.
RunCommandAsync(string, IReadOnlyDictionary<string, string>, CancellationToken)
Section titled “RunCommandAsync(string, IReadOnlyDictionary<string, string>, CancellationToken)”Runs a command in this session with prefilled answers for interactive prompts.
public ValueTask<CommandExecution> RunCommandAsync(string commandText, IReadOnlyDictionary<string, string> answers, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”commandText(string): The command text to execute.answers(IReadOnlyDictionary<string, string>): Prompt answers keyed by prompt name. Overrides session-level answers for the same name.cancellationToken(CancellationToken): Cancellation token.
Returns
Section titled “Returns”ValueTask<CommandExecution> - The execution result.
RunCommandAsync(string, CancellationToken)
Section titled “RunCommandAsync(string, CancellationToken)”Runs a command in this session.
public ValueTask<CommandExecution> RunCommandAsync(string commandText, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”commandText(string): The command text to execute.cancellationToken(CancellationToken): Cancellation token.
Returns
Section titled “Returns”ValueTask<CommandExecution> - The execution result.
Properties
Section titled “Properties”SessionId
Section titled “SessionId”This session’s id, unique within its ReplTestHost and stable for the session’s lifetime.
public string SessionId { get; }