ReplPlatformProfile
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.
- Kind:
Class - Namespace: Repl.Testing
- Assembly:
Repl.Testing - Source: src/Repl.Testing/ReplPlatformProfile.cs
Signature
Section titled “Signature”public sealed record ReplPlatformProfile : IEquatable<ReplPlatformProfile>Inheritance
Section titled “Inheritance”Implements
Section titled “Implements”IEquatable<ReplPlatformProfile>
Properties
Section titled “Properties”Android
Section titled “Android”Android, where the signal bridge is unsupported and handling stays caller-owned.
public static ReplPlatformProfile Android { get; }Returns
Section titled “Returns”Browser
Section titled “Browser”WebAssembly in a browser, where the signal bridge is unsupported.
public static ReplPlatformProfile Browser { get; }Returns
Section titled “Returns”Current
Section titled “Current”The platform the test is actually running on, taken from OperatingSystem.
public static ReplPlatformProfile Current { get; }Returns
Section titled “Returns”iOS or Mac Catalyst, where the signal bridge is unsupported.
public static ReplPlatformProfile IOS { get; }Returns
Section titled “Returns”IsAndroid
Section titled “IsAndroid”Whether the declared platform is Android.
public bool IsAndroid { get; }Returns
Section titled “Returns”IsBrowser
Section titled “IsBrowser”Whether the declared platform is WebAssembly in a browser.
public bool IsBrowser { get; }Returns
Section titled “Returns”IsIOSOrMacCatalyst
Section titled “IsIOSOrMacCatalyst”Whether the declared platform is iOS or Mac Catalyst.
public bool IsIOSOrMacCatalyst { get; }Returns
Section titled “Returns”IsSignalBridgeSupported
Section titled “IsSignalBridgeSupported”Whether the signal bridge is available at all on the declared platform. When it is not, automatic handling degrades to caller-owned and says so once through the run’s diagnostics.
public bool IsSignalBridgeSupported { get; }Returns
Section titled “Returns”IsTvOS
Section titled “IsTvOS”Whether the declared platform is tvOS.
public bool IsTvOS { get; }Returns
Section titled “Returns”IsWindows
Section titled “IsWindows”Whether the declared platform is Windows.
public bool IsWindows { get; }Returns
Section titled “Returns”tvOS, where the signal bridge is unsupported.
public static ReplPlatformProfile TvOS { get; }Returns
Section titled “Returns”Linux or macOS: Ctrl+Break is not a signal, and SIGTERM is registered. Both make the same decisions here, so they share one profile rather than pretending to differ.
public static ReplPlatformProfile Unix { get; }Returns
Section titled “Returns”Windows
Section titled “Windows”Windows: Ctrl+Break counts as a signal, and no SIGTERM registration is installed because the console keys are already owned by the cancel-key path.
public static ReplPlatformProfile Windows { get; }