Repl.Testing
- Kind:
Namespace - Assembly:
Repl.Testing
- CommandEvent
Class- Base event emitted while executing a command in the test harness. - CommandExecution
Class- Result for one executed command within a simulated session. - InteractionObservedEvent
Class- Interaction event observed from the REPL runtime. - OutputWrittenEvent
Class- Output text chunk emitted by the host. - ReplPlatformProfile
Class- The platform whose signal-handling decisions a test wants to exercise, independent of the platform it is running on. Declaring one lets a Windows wiring decision be asserted from Linux and the other way round.
A declared platform changes decisions only, and never causes an operating-system registration to be installed on that platform’s behalf. One consequence is worth knowing: a profile with no signal bridge — Browser, Android, IOS, TvOS — installs no console cancel-key handler either, so while such a run is in flight a real Ctrl+C aimed at your test runner takes its normal course instead of being claimed by the run. Under the other profiles it is claimed, as it would be for any standalone run.
What a declared platform cannot buy: real delivery. No kernel will deliver a Windows console control event on Linux, and whether a registration would succeed on a given host is a fact about that host. Those need a spawned process on the matching platform.
Use the named profiles. The flags are readable so a test can assert on them, but not settable, so that combinations no device has — Android and Windows at once — cannot be built by mistake.
- ReplProcessProbe
Class- Spawns an application and sends it real operating-system signals, for the guarantees an in-memory test cannot reach: that the process actually terminates, with the exit code the shell sees, after the cleanup it was given time to run.
Use ReplProcessSignalHarness for everything else. It is deterministic, fast, and covers every decision the framework makes. This one exists for the part that is only true of a real process, and it is correspondingly slower and platform-bound.
Signals are sent on Unix only. Delivering one to another process on Windows needs console control events and console attachment rather than a signal, which this deliberately does not do — see issue #83. SendSignalAsync(ReplProcessSignal, CancellationToken) throws PlatformNotSupportedException there, and the rest of the probe still works, so a cross-platform suite can spawn and assert everywhere and skip only the delivery.
- ReplProcessProbeOptions
Class- Options for one ReplProcessProbe. - ReplProcessSignal
Enum- A process signal a test can deliver. Append-only: a new member may be added, but the meaning of an existing one never changes. - ReplProcessSignalHarness
Class- Drives the process-signal lifecycle deterministically, in memory, against an application under test: a first signal claims the runs in flight and cancels them cooperatively, a second one steps aside for the operating system.
This is a sibling of ReplTestHost rather than part of it. Sessions are isolated from
each other; signal handling is process-global, so a harness owns it for its lifetime and only one
can exist at a time. Dispose it — ownership is released there and nowhere else, so a harness
that is never disposed leaves every later run with automatic signal handling refused for the rest
of the process. Constructing a second one while the first is alive throws instead of
producing a flaky pair — configure your test framework not to run these in parallel:
MSTest [DoNotParallelize], xUnit a shared [Collection] or
[assembly: CollectionBehavior(DisableTestParallelization = true)], NUnit
[NonParallelizable]. Sharding across separate processes needs none of this.
What it proves: the framework’s decision about each signal, the diagnostics it writes, the exit code the run resolves to, and every platform wiring decision through Platform. What it cannot prove: that a process would actually die. Nothing dies here, so a second signal reports WouldTerminateProcess and execution continues. That half needs a spawned process on the matching platform.
No operating-system signal registration is ever installed — no PosixSignalRegistration,
on any platform. What is not isolated, and cannot be, is the console cancel-key handler: starting a
run registers one, because arbitrating Ctrl+C between an interactive session and a standalone run is
part of what these tests exist to exercise, and the subscription behind it is installed once per
process and never removed by design. So while a run is in flight, a real Ctrl+C aimed at your
test runner is claimed by the run under test and the first press does not stop it — press again to
escalate. See ReplPlatformProfile for how a declared platform affects that.
- ReplProcessSignalOptions
Class- Options for one ReplProcessSignalHarness. - ReplScenarioOptions
Class- Options controlling the in-memory REPL test orchestrator. - ReplSessionHandle
Class- Handle for a single live in-memory REPL session. - ReplSignalDelivery
Enum- What the framework decided about one delivered signal. - ReplSignalRun
Class- A run started by StartRunAsync(string, CancellationToken) and still in flight. Its signal scope is registered by the time the start call returns, so a signal delivered from here on reaches it rather than falling through as inert — for as long as the run lasts. See StartRunAsync(string, CancellationToken) for what the start does and does not guarantee. - ReplSignalRunResult
Class- What one run under a ReplProcessSignalHarness ended with. - ReplTestHost
Class- In-memory orchestrator for opening and coordinating multiple REPL test sessions. - ResultProducedEvent
Class- Raw result object emitted by command execution. - SessionDescriptor
Class- Logical metadata used to shape a simulated session. - SessionSnapshot
Class- Immutable snapshot of a live simulated session.