LanguageExt.Sys

LanguageExt.Sys Test Implementations

Contents

record ConsoleIO (MemoryConsole mem) Source #

Encapsulated in-memory console No public API exists for this. Use Sys.IO.Console.* to interact with the console

Primarily used for testing (for use with TestRuntime or your own testing runtime)

Properties

property IO<ConsoleColor> BgColor Source #

property IO<ConsoleColor> Color Source #

Methods

method IO<Option<ConsoleKeyInfo>> ReadKey () Source #

method IO<Unit> Clear () Source #

method IO<Unit> SetBgColor (ConsoleColor color) Source #

method IO<Unit> SetColor (ConsoleColor color) Source #

method IO<Unit> ResetColor () Source #

method IO<Option<int>> Read () Source #

method IO<Option<string>> ReadLine () Source #

method IO<Unit> WriteLine () Source #

method IO<Unit> WriteLine (string value) Source #

method IO<Unit> Write (string value) Source #

record DirectoryIO (string root) Source #

Methods

method IO<DirectoryInfo> Create (string path) Source #

method IO<Unit> Delete (string path, bool recursive = true) Source #

method IO<Option<DirectoryInfo>> GetParent (string path) Source #

method IO<bool> Exists (string path) Source #

method IO<Unit> SetCreationTime (string path, DateTime creationTime) Source #

method IO<Unit> SetCreationTimeUtc (string path, DateTime creationTimeUtc) Source #

method IO<DateTime> GetCreationTime (string path) Source #

method IO<DateTime> GetCreationTimeUtc (string path) Source #

method IO<Unit> SetLastWriteTime (string path, DateTime lastWriteTime) Source #

method IO<Unit> SetLastWriteTimeUtc (string path, DateTime lastWriteTimeUtc) Source #

method IO<DateTime> GetLastWriteTime (string path) Source #

method IO<DateTime> GetLastWriteTimeUtc (string path) Source #

method IO<Unit> SetLastAccessTime (string path, DateTime lastAccessTime) Source #

method IO<Unit> SetLastAccessTimeUtc (string path, DateTime lastAccessTimeUtc) Source #

method IO<DateTime> GetLastAccessTime (string path) Source #

method IO<DateTime> GetLastAccessTimeUtc (string path) Source #

method IO<Seq<string>> EnumerateDirectories (string path) Source #

method IO<Seq<string>> EnumerateDirectories (string path, string searchPattern) Source #

method IO<Seq<string>> EnumerateDirectories (string path, string searchPattern, SearchOption searchOption) Source #

method IO<Seq<string>> EnumerateFiles (string path) Source #

method IO<Seq<string>> EnumerateFiles (string path, string searchPattern) Source #

method IO<Seq<string>> EnumerateFiles (string path, string searchPattern, SearchOption searchOption) Source #

method IO<Seq<string>> EnumerateFileSystemEntries (string path) Source #

method IO<Seq<string>> EnumerateFileSystemEntries (string path, string searchPattern) Source #

method IO<Seq<string>> EnumerateFileSystemEntries (string path, string searchPattern, SearchOption searchOption) Source #

method IO<string> GetDirectoryRoot (string path) Source #

method IO<string> GetCurrentDirectory () Source #

method IO<Unit> SetCurrentDirectory (string path) Source #

method IO<Unit> Move (string sourceDirName, string destDirName) Source #

method IO<Seq<string>> GetLogicalDrives () Source #

record EnvironmentIO (MemorySystemEnvironment env) Source #

Methods

method IO<string> CommandLine () Source #

Gets the command line for this process.

method IO<int> CurrentManagedThreadId () Source #

Gets a unique identifier for the current managed thread.

method IO<Unit> Exit (int exitCode) Source #

Terminates this process and returns an exit code to the operating system.

method IO<int> ExitCode () Source #

Gets the exit code of the process.

method IO<Unit> SetExitCode (int exitCode) Source #

Sets the exit code of the process.

method IO<string> ExpandEnvironmentVariables (string name) Source #

Replaces the name of each environment variable embedded in the specified string with the string equivalent of the value of the variable, then returns the resulting string.

method IO<Unit> FailFast (Option<string> message) Source #

Immediately terminates a process after writing a message to the Windows Application event log, and then includes the message in error reporting to Microsoft.

method IO<Unit> FailFast (Option<string> message, Option<Exception> exception) Source #

Immediately terminates a process after writing a message to the Windows Application event log, and then includes the message and exception information in error reporting to Microsoft.

method IO<Seq<string>> GetCommandLineArgs () Source #

Returns a string array containing the command-line arguments for the current process.

method IO<Option<string>> GetEnvironmentVariable (string variable) Source #

Retrieves the value of an environment variable from the current process.

method IO<Option<string>> GetEnvironmentVariable (string variable, EnvironmentVariableTarget target) Source #

Retrieves the value of an environment variable from the current process or from the Windows operating system registry key for the current user or local machine.

method IO<HashMap<string, Option<string>>> GetEnvironmentVariables () Source #

Retrieves all environment variable names and their values from the current process.

method IO<HashMap<string, Option<string>>> GetEnvironmentVariables (EnvironmentVariableTarget target) Source #

Retrieves all environment variable names and their values from the current process, or from the Windows operating system registry key for the current user or local machine.

method IO<string> GetFolderPath (Environment.SpecialFolder folder) Source #

Gets the path to the system special folder that is identified by the specified enumeration.

method IO<string> GetFolderPath (Environment.SpecialFolder folder, Environment.SpecialFolderOption option) Source #

Gets the path to the system special folder that is identified by the specified enumeration, and uses a specified option for accessing special folders.

method IO<Seq<string>> GetLogicalDrives () Source #

Returns an array of string containing the names of the logical drives on the current computer.

method IO<bool> HasShutdownStarted () Source #

Gets a value that indicates whether the current application domain is being unloaded or the common language runtime (CLR) is shutting down.

method IO<bool> Is64BitOperatingSystem () Source #

Determines whether the current operating system is a 64-bit operating system.

method IO<bool> Is64BitProcess () Source #

Determines whether the current process is a 64-bit process.

method IO<string> MachineName () Source #

Gets the NetBIOS name of this local computer.

method IO<string> NewLine () Source #

Gets the newline string defined for this environment.

method IO<OperatingSystem> OSVersion () Source #

Gets an OperatingSystem object that contains the current platform identifier and version number.

method IO<int> ProcessorCount () Source #

Gets the number of processors on the current machine.

method IO<Unit> SetEnvironmentVariable (string variable, Option<string> value) Source #

Creates, modifies, or deletes an environment variable stored in the current process.

method IO<Unit> SetEnvironmentVariable (string variable, Option<string> value, EnvironmentVariableTarget target) Source #

Creates, modifies, or deletes an environment variable stored in the current process or in the Windows operating system registry key reserved for the current user or local machine.

method IO<string> StackTrace () Source #

Gets current stack trace information.

method IO<string> SystemDirectory () Source #

Gets the fully qualified path of the system directory.

method IO<int> SystemPageSize () Source #

Gets the number of bytes in the operating system's memory page.

method IO<long> TickCount () Source #

Gets the number of milliseconds elapsed since the system started.

method IO<string> UserDomainName () Source #

Gets the network domain name associated with the current user.

method IO<bool> UserInteractive () Source #

Gets a value indicating whether the current process is running in user interactive mode.

method IO<string> UserName () Source #

Gets the user name of the person who is currently logged on to the operating system.

method IO<Version> Version () Source #

Gets a Version object that describes the major, minor, build, and revision numbers of the common language runtime.

method IO<long> WorkingSet () Source #

Gets the amount of physical memory mapped to the process context.

record FileIO (string root) Source #

Test world interaction with the file-system

Primarily used for testing (for use with TestRuntime or your own testing runtime)

Methods

method IO<Unit> Copy (string fromPath, string toPath, bool overwrite = false) Source #

Copy file from one place to another

method IO<Unit> Move (string fromPath, string toPath) Source #

Move file from one place to another

method IO<Unit> Move (string fromPath, string toPath, bool overwrite) Source #

Move file from one place to another

method IO<Unit> AppendAllLines (string path, IEnumerable<string> lines, Encoding encoding) Source #

Append lines to the end of a file

method IO<Seq<string>> ReadAllLines (string path, Encoding encoding) Source #

Read all lines from a file

method IO<byte[]> ReadAllBytes (string path) Source #

Read all lines from a file

method IO<Unit> WriteAllLines (string path, IEnumerable<string> lines, Encoding encoding) Source #

Write all lines to a file

method IO<Unit> WriteAllBytes (string path, byte[] data) Source #

Write all lines to a file

method IO<string> ReadAllText (string path, Encoding encoding) Source #

Read text from a file

method IO<Unit> WriteAllText (string path, string text, Encoding encoding) Source #

Write text to a file

method IO<Unit> Delete (string path) Source #

Delete a file

method IO<bool> Exists (string path) Source #

True if a file at the path exists

method IO<TextReader> OpenText (string path) Source #

Open a text file

method IO<TextWriter> CreateText (string path) Source #

Create a new text file to stream to

method IO<TextWriter> AppendText (string path) Source #

Return a stream to append text to

method IO<Stream> OpenRead (string path) Source #

Open a file-stream

method IO<Stream> Open (string path, FileMode mode) Source #

Open a file-stream

method IO<Stream> Open (string path, FileMode mode, FileAccess access) Source #

Open a file-stream

method IO<Stream> OpenWrite (string path) Source #

Open a file-stream

record TestTimeSpec (Schedule Schedule, DateTime Start) Source #

Methods

method TestTimeSpec FixedFromSpecified (DateTime start) Source #

Time never passes, it has a constant value of start

method TestTimeSpec FixedFromNow (DateTime start) Source #

Time never passes, it has a constant value of DateTime.Now (as it was set when you call this method)

method TestTimeSpec RunningFromSpecified (DateTime start) Source #

Time passes at 1 millisecond per tick starting from start

method TestTimeSpec RunningFromNow () Source #

Time passes at 1 millisecond per tick starting from DateTime.Now

struct TextReadIO Source #

Fields

field Sys.Traits.TextReadIO Default = new TextReadIO() Source #

Methods

method IO<Option<string>> ReadLine (TextReader reader) Source #

Read a line of text from the stream

method IO<string> ReadToEnd (TextReader reader) Source #

Read the rest of the text in the stream

method IO<int> Read (TextReader reader, Memory<char> buffer) Source #

Read chars from the stream into the buffer Returns the number of chars read

method IO<Unit> Close (TextReader reader) Source #

Close the reader

class TimeIO Source #

Properties

property IO<DateTime> UtcNow Source #

Current UTC date time

property IO<DateTime> Now Source #

Current local date time

property IO<DateTime> Today Source #

Today's date

Constructors

constructor TimeIO (TestTimeSpec spec) Source #

Methods

method void Dispose () Source #

method IO<Unit> SleepUntil (DateTime dt) Source #

Pause a task until a specified time

method IO<Unit> SleepFor (TimeSpan ts) Source #

Pause a task until for a specified length of time