- ConsoleIO
- ConsoleIO (MemoryConsole mem)
- ReadKey ()
- Clear ()
- SetBgColor (ConsoleColor color)
- SetColor (ConsoleColor color)
- ResetColor ()
- BgColor
- Color
- Read ()
- ReadLine ()
- WriteLine ()
- WriteLine (string value)
- Write (string value)
- DirectoryIO
- DirectoryIO (MemoryFS fs, DateTime now)
- Create (string path)
- Delete (string path, bool recursive = true)
- GetParent (string path)
- Exists (string path)
- SetCreationTime (string path, DateTime creationTime)
- SetCreationTimeUtc (string path, DateTime creationTimeUtc)
- GetCreationTime (string path)
- GetCreationTimeUtc (string path)
- SetLastWriteTime (string path, DateTime lastWriteTime)
- SetLastWriteTimeUtc (string path, DateTime lastWriteTimeUtc)
- GetLastWriteTime (string path)
- GetLastWriteTimeUtc (string path)
- SetLastAccessTime (string path, DateTime lastAccessTime)
- SetLastAccessTimeUtc (string path, DateTime lastAccessTimeUtc)
- GetLastAccessTime (string path)
- GetLastAccessTimeUtc (string path)
- EnumerateDirectories (string path)
- EnumerateDirectories (string path, string searchPattern)
- EnumerateDirectories (string path, string searchPattern, SearchOption searchOption)
- EnumerateFiles (string path)
- EnumerateFiles (string path, string searchPattern)
- EnumerateFiles (string path, string searchPattern, SearchOption searchOption)
- EnumerateFileSystemEntries (string path)
- EnumerateFileSystemEntries (string path, string searchPattern)
- EnumerateFileSystemEntries (string path, string searchPattern, SearchOption searchOption)
- GetDirectoryRoot (string path)
- GetCurrentDirectory ()
- SetCurrentDirectory (string path)
- Move (string sourceDirName, string destDirName)
- GetLogicalDrives ()
- EnvironmentIO
- EnvironmentIO (MemorySystemEnvironment env)
- CommandLine ()
- CurrentManagedThreadId ()
- Exit (int exitCode)
- ExitCode ()
- SetExitCode (int exitCode)
- ExpandEnvironmentVariables (string name)
- FailFast (Option<string> message)
- FailFast (Option<string> message, Option<Exception> exception)
- GetCommandLineArgs ()
- GetEnvironmentVariable (string variable)
- GetEnvironmentVariable (string variable, EnvironmentVariableTarget target)
- GetEnvironmentVariables ()
- GetEnvironmentVariables (EnvironmentVariableTarget target)
- GetFolderPath (System.Environment.SpecialFolder folder)
- GetFolderPath (System.Environment.SpecialFolder folder, System.Environment.SpecialFolderOption option)
- GetLogicalDrives ()
- HasShutdownStarted ()
- Is64BitOperatingSystem ()
- Is64BitProcess ()
- MachineName ()
- NewLine ()
- OSVersion ()
- ProcessorCount ()
- SetEnvironmentVariable (string variable, Option<string> value)
- SetEnvironmentVariable (string variable, Option<string> value, EnvironmentVariableTarget target)
- StackTrace ()
- SystemDirectory ()
- SystemPageSize ()
- TickCount ()
- UserDomainName ()
- UserInteractive ()
- UserName ()
- Version ()
- WorkingSet ()
- FileIO
- FileIO (MemoryFS fs, DateTime now)
- Copy (string fromPath, string toPath, bool overwrite = false)
- AppendAllLines (string path, IEnumerable<string> lines, Encoding encoding, CancellationToken token)
- ReadAllLines (string path, Encoding encoding, CancellationToken token)
- ReadAllBytes (string path, CancellationToken token)
- WriteAllLines (string path, IEnumerable<string> lines, Encoding encoding, CancellationToken token)
- WriteAllBytes (string path, byte[] data, CancellationToken token)
- ReadAllText (string path, Encoding encoding, CancellationToken token)
- WriteAllText (string path, string text, Encoding encoding, CancellationToken token)
- Delete (string path)
- Exists (string path)
- OpenText (string path)
- CreateText (string path)
- AppendText (string path)
- OpenRead (string path)
- Open (string path, FileMode mode)
- Open (string path, FileMode mode, FileAccess access)
- OpenWrite (string path)
- Runtime
- env
- Env
- New (TestTimeSpec? timeSpec = default)
- New (CancellationTokenSource source, TestTimeSpec? timeSpec = default)
- New (Encoding encoding, TestTimeSpec? timeSpec = default)
- New (Encoding encoding, CancellationTokenSource source, TestTimeSpec? timeSpec = default)
- LocalCancel
- CancellationToken
- CancellationTokenSource
- Encoding
- ConsoleEff
- FileEff
- DirectoryEff
- TextReadEff
- TimeEff
- EnvironmentEff
- RuntimeEnv
- Source
- Token
- Encoding
- Console
- FileSystem
- TimeSpec
- SysEnv
- RuntimeEnv ( CancellationTokenSource source, CancellationToken token, Encoding encoding, MemoryConsole console, MemoryFS fileSystem, TestTimeSpec? timeSpec, MemorySystemEnvironment sysEnv)
- RuntimeEnv ( CancellationTokenSource source, Encoding encoding, MemoryConsole console, MemoryFS fileSystem, TestTimeSpec? timeSpec, MemorySystemEnvironment sysEnv)
- LocalCancel
- TestTimeSpec
- FixedFromNow ()
- FixedFromSpecified (DateTime state)
- RunningFromNow ()
- RunningFromSpecified (DateTime state)
- TextReadIO
- Default = new TextReadIO()
- ReadLine (TextReader reader)
- ReadToEnd (TextReader reader)
- Read (TextReader reader, Memory<char> buffer)
- Close (TextReader reader)
- TimeIO
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)
method Unit SetBgColor (ConsoleColor color) Source #
method Unit ResetColor () Source #
struct DirectoryIO Source #
constructor DirectoryIO (MemoryFS fs, DateTime now) Source #
method Unit SetCreationTime (string path, DateTime creationTime) Source #
method Unit SetCreationTimeUtc (string path, DateTime creationTimeUtc) Source #
method DateTime GetCreationTime (string path) Source #
method DateTime GetCreationTimeUtc (string path) Source #
method Unit SetLastWriteTime (string path, DateTime lastWriteTime) Source #
method Unit SetLastWriteTimeUtc (string path, DateTime lastWriteTimeUtc) Source #
method DateTime GetLastWriteTime (string path) Source #
method DateTime GetLastWriteTimeUtc (string path) Source #
method Unit SetLastAccessTime (string path, DateTime lastAccessTime) Source #
method Unit SetLastAccessTimeUtc (string path, DateTime lastAccessTimeUtc) Source #
method DateTime GetLastAccessTime (string path) Source #
method DateTime GetLastAccessTimeUtc (string path) Source #
method Seq<string> EnumerateDirectories (string path) Source #
method Seq<string> EnumerateDirectories (string path, string searchPattern) Source #
method Seq<string> EnumerateDirectories (string path, string searchPattern, SearchOption searchOption) Source #
method Seq<string> EnumerateFiles (string path) Source #
method Seq<string> EnumerateFiles (string path, string searchPattern) Source #
method Seq<string> EnumerateFiles (string path, string searchPattern, SearchOption searchOption) Source #
method Seq<string> EnumerateFileSystemEntries (string path) Source #
method Seq<string> EnumerateFileSystemEntries (string path, string searchPattern) Source #
method Seq<string> EnumerateFileSystemEntries (string path, string searchPattern, SearchOption searchOption) Source #
method string GetDirectoryRoot (string path) Source #
method string GetCurrentDirectory () Source #
method Unit SetCurrentDirectory (string path) Source #
method Seq<string> GetLogicalDrives () Source #
struct EnvironmentIO Source #
constructor EnvironmentIO (MemorySystemEnvironment env) Source #
method string CommandLine () Source #
Gets the command line for this process.
method int CurrentManagedThreadId () Source #
Gets a unique identifier for the current managed thread.
method Unit Exit (int exitCode) Source #
Terminates this process and returns an exit code to the operating system.
method Unit SetExitCode (int exitCode) Source #
Sets the exit code of the process.
method 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 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 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 Seq<string> GetCommandLineArgs () Source #
Returns a string array containing the command-line arguments for the current process.
method Option<string> GetEnvironmentVariable (string variable) Source #
Retrieves the value of an environment variable from the current process.
method 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 HashMap<string, string> GetEnvironmentVariables () Source #
Retrieves all environment variable names and their values from the current process.
method HashMap<string, 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 string GetFolderPath (System.Environment.SpecialFolder folder) Source #
Gets the path to the system special folder that is identified by the specified enumeration.
method string GetFolderPath (System.Environment.SpecialFolder folder, System.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 Seq<string> GetLogicalDrives () Source #
Returns an array of string containing the names of the logical drives on the current computer.
method 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 bool Is64BitOperatingSystem () Source #
Determines whether the current operating system is a 64-bit operating system.
method bool Is64BitProcess () Source #
Determines whether the current process is a 64-bit process.
method string MachineName () Source #
Gets the NetBIOS name of this local computer.
method OperatingSystem OSVersion () Source #
Gets an OperatingSystem object that contains the current platform identifier and version number.
method int ProcessorCount () Source #
Gets the number of processors on the current machine.
method Unit SetEnvironmentVariable (string variable, Option<string> value) Source #
Creates, modifies, or deletes an environment variable stored in the current process.
method 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 string StackTrace () Source #
Gets current stack trace information.
method string SystemDirectory () Source #
Gets the fully qualified path of the system directory.
method int SystemPageSize () Source #
Gets the number of bytes in the operating system's memory page.
method string UserDomainName () Source #
Gets the network domain name associated with the current user.
method bool UserInteractive () Source #
Gets a value indicating whether the current process is running in user interactive mode.
method string UserName () Source #
Gets the user name of the person who is currently logged on to the operating system.
method Version Version () Source #
Gets a Version object that describes the major, minor, build, and revision numbers of the common language runtime.
method long WorkingSet () Source #
Gets the amount of physical memory mapped to the process context.
Test world interaction with the file-system
Primarily used for testing (for use with TestRuntime or your own testing runtime)
method Unit Copy (string fromPath, string toPath, bool overwrite = false) Source #
Copy file from one place to another
method ValueTask<Unit> AppendAllLines (string path, IEnumerable<string> lines, Encoding encoding, CancellationToken token) Source #
Append lines to the end of a file
method ValueTask<Seq<string>> ReadAllLines (string path, Encoding encoding, CancellationToken token) Source #
Read all lines from a file
method ValueTask<byte[]> ReadAllBytes (string path, CancellationToken token) Source #
Read all lines from a file
method ValueTask<Unit> WriteAllLines (string path, IEnumerable<string> lines, Encoding encoding, CancellationToken token) Source #
Write all lines to a file
method ValueTask<Unit> WriteAllBytes (string path, byte[] data, CancellationToken token) Source #
Write all lines to a file
method ValueTask<string> ReadAllText (string path, Encoding encoding, CancellationToken token) Source #
Read text from a file
method ValueTask<Unit> WriteAllText (string path, string text, Encoding encoding, CancellationToken token) Source #
Write text to a file
method TextWriter CreateText (string path) Source #
Create a new text file to stream to
method TextWriter AppendText (string path) Source #
Return a stream to append text to
Test IO runtime
property Runtime LocalCancel Source #
Create a new Runtime with a fresh cancellation token
Used by localCancel to create new cancellation context for its sub-environment
returns | New runtime |
property CancellationToken CancellationToken Source #
Direct access to cancellation token
property CancellationTokenSource CancellationTokenSource Source #
Directly access the cancellation token source
returns | CancellationTokenSource |
property Eff<Runtime, Traits.ConsoleIO> ConsoleEff Source #
Access the console environment
returns | Console environment |
property Eff<Runtime, Traits.FileIO> FileEff Source #
Access the file environment
returns | File environment |
property Eff<Runtime, Traits.DirectoryIO> DirectoryEff Source #
Access the directory environment
returns | Directory environment |
property Eff<Runtime, Traits.TextReadIO> TextReadEff Source #
Access the TextReader environment
returns | TextReader environment |
property Eff<Runtime, Traits.TimeIO> TimeEff Source #
Access the time environment
returns | Time environment |
property Eff<Runtime, Traits.EnvironmentIO> EnvironmentEff Source #
Access the operating-system environment
returns | Operating-system environment environment |
method Runtime New (TestTimeSpec? timeSpec = default) Source #
Constructor function
param | timeSpec | Defines how time works in the runtime |
method Runtime New (CancellationTokenSource source, TestTimeSpec? timeSpec = default) Source #
Constructor function
param | source | Cancellation token source |
param | timeSpec | Defines how time works in the runtime |
class RuntimeEnv Source #
field MemoryFS FileSystem Source #
property RuntimeEnv LocalCancel Source #
constructor RuntimeEnv ( CancellationTokenSource source, CancellationToken token, Encoding encoding, MemoryConsole console, MemoryFS fileSystem, TestTimeSpec? timeSpec, MemorySystemEnvironment sysEnv) Source #
constructor RuntimeEnv ( CancellationTokenSource source, Encoding encoding, MemoryConsole console, MemoryFS fileSystem, TestTimeSpec? timeSpec, MemorySystemEnvironment sysEnv) Source #
class TestTimeSpec Source #
Unit tests often need to run at a specified time, or sometimes need time to stand still This is a simple specification builder for Sys.Test.TimeIO that allows you to pass that requirement through the runtime.
method TestTimeSpec FixedFromNow () Source #
Time never passes, it has a constant value of DateTime.Now (as it was set when you call this method)
method TestTimeSpec FixedFromSpecified (DateTime state) Source #
Time never passes, it has a constant value of state
method TestTimeSpec RunningFromNow () Source #
Time passes normally, this is a straight pass-through to DateTime.Now
method TestTimeSpec RunningFromSpecified (DateTime state) Source #
Time passes normally, but it is set with an initial state and flows from there
struct TextReadIO Source #
field Sys.Traits.TextReadIO Default = new TextReadIO() Source #
method ValueTask<Option<string>> ReadLine (TextReader reader) Source #
Read a line of text from the stream
method ValueTask<string> ReadToEnd (TextReader reader) Source #
Read the rest of the text in the stream