LanguageExt.Sys

LanguageExt.Sys

Contents

Sub modules

Live
Sys
Test
Traits

class MemoryConsole Source #

An in-memory console emulation

Mostly for use in test runtimes. This simulates the real System.IO.Console, with additional functionality for pre-building a keyboard buffer (WriteKey, WriteKeyChar, WriteKeyString) and committing them as though they were typed. ReadKey and the other Read* methods will read the entries from the pre-built keyboard buffer.

There is no public API for this, other than the prepping of the keyboard buffer, which is outside of the normal console system.

Constructors

constructor MemoryConsole () Source #

Methods

method Unit WriteKey (ConsoleKeyInfo key) Source #

Write a key into the keyboard buffer

Won't show in the console until Commit or Read* is called

method Unit WriteKeyChar (char ch) Source #

Write a character into the keyboard buffer

Won't show in the console until Commit or Read* is called

method Unit WriteKeyString (string str) Source #

Write a character into the keyboard buffer

No newline character is written Won't show in the console until Commit or Read* is called

method Unit WriteKeyLine (string str) Source #

Write a series of characters into the keyboard buffer followed by a newline

Won't show in the console until Commit or Read* is called

method Unit Commit () Source #

Commit what's in the keyboard buffer (as though they've been typed in)

Parameters

returns

method IEnumerator<string> GetEnumerator () Source #

class MemoryFS Source #

Encapsulated in-memory file-system No public API exists for this other than for adding and getting the logical in-memory drives

Primarily used for testing (for use with Sys.Test.Runtime or your own runtimes)

This isn't anywhere near as strict as the real file-system, and so it shouldn't really be used to test file-operations. It should be used to test simple access to files without having to create them for real, or worry about what drives exist. Error messages shouldn't be relied on, only success and failure.

Fields

Constructors

constructor MemoryFS () Source #

Methods

method Seq<string> GetLogicalDrives () Source #

Get the logical in-memory drives

Parameters

returns

Sequence of drive names

method Unit AddLogicalDrive (string name) Source #

Add a logical in-memory drive

class MemorySystemEnvironment Source #

In-memory representation of the System.Environment

Use: MemorySystemEnvironment.InitFromSystem(), to initialise from the real System.Environment and then tweak for use in unit-tests using the With(...) method.

Fields

field ConcurrentDictionary<string, string> ProcessEnvironmentVariables Source #

field ConcurrentDictionary<string, string> UserEnvironmentVariables Source #

field ConcurrentDictionary<string, string> SystemEnvironmentVariables Source #

field int ExitCode Source #

field string CommandLine Source #

field Seq<string> CommandLineArgs Source #

field Seq<string> LogicalDrives Source #

field string NewLine Source #

field bool Is64BitProcess Source #

field string MachineName Source #

field OperatingSystem OSVersion Source #

field string StackTrace Source #

field string SystemDirectory Source #

field int TickCount Source #

field string UserDomainName Source #

field string UserName Source #

field Version Version Source #

field long WorkingSet Source #

field Func<System.Environment.SpecialFolder, System.Environment.SpecialFolderOption, string> GetFolderPath Source #

Constructors

constructor MemorySystemEnvironment ( ConcurrentDictionary<string, string> processEnvironmentVariables, ConcurrentDictionary<string, string> userEnvironmentVariables, ConcurrentDictionary<string, string> systemEnvironmentVariables, int exitCode, string commandLine, int currentManagedThreadId, Seq<string> commandLineArgs, Seq<string> logicalDrives, string newLine, bool hasShutdownStarted, bool is64BitOperatingSystem, bool is64BitProcess, string machineName, OperatingSystem osVersion, int processorCount, string stackTrace, string systemDirectory, int systemPageSize, int tickCount, string userDomainName, bool userInteractive, string userName, Version version, long workingSet, Func<System.Environment.SpecialFolder, System.Environment.SpecialFolderOption, string> getFolderPath) Source #

Methods

method MemorySystemEnvironment With ( ConcurrentDictionary<string, string>? ProcessEnvironmentVariables = null, ConcurrentDictionary<string, string>? UserEnvironmentVariables = null, ConcurrentDictionary<string, string>? SystemEnvironmentVariables = null, int? ExitCode = null, string? CommandLine = null, int? CurrentManagedThreadId = null, Seq<string>? CommandLineArgs = null, Seq<string>? LogicalDrives = null, string? NewLine = null, bool? HasShutdownStarted = null, bool? Is64BitOperatingSystem = null, bool? Is64BitProcess = null, string? MachineName = null, OperatingSystem? OSVersion = null, int? ProcessorCount = null, string? StackTrace = null, string? SystemDirectory = null, int? SystemPageSize = null, int? TickCount = null, string? UserDomainName = null, bool? UserInteractive = null, string? UserName = null, Version? Version = null, long? WorkingSet = null, Func<System.Environment.SpecialFolder, System.Environment.SpecialFolderOption, string>? GetFolderPath = null) Source #

method MemorySystemEnvironment InitFromSystem () Source #