Rig.TUnit.Storage.FileSystem 0.1.0-beta.2

This is a prerelease version of Rig.TUnit.Storage.FileSystem.
dotnet add package Rig.TUnit.Storage.FileSystem --version 0.1.0-beta.2
                    
NuGet\Install-Package Rig.TUnit.Storage.FileSystem -Version 0.1.0-beta.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Rig.TUnit.Storage.FileSystem" Version="0.1.0-beta.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Rig.TUnit.Storage.FileSystem" Version="0.1.0-beta.2" />
                    
Directory.Packages.props
<PackageReference Include="Rig.TUnit.Storage.FileSystem" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Rig.TUnit.Storage.FileSystem --version 0.1.0-beta.2
                    
#r "nuget: Rig.TUnit.Storage.FileSystem, 0.1.0-beta.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Rig.TUnit.Storage.FileSystem@0.1.0-beta.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Rig.TUnit.Storage.FileSystem&version=0.1.0-beta.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Rig.TUnit.Storage.FileSystem&version=0.1.0-beta.2&prerelease
                    
Install as a Cake Tool

Rig.TUnit.Storage.FileSystem

In-process filesystem fixture on System.IO.Abstractions with traversal-safe PathSandboxHelper. No container required.

What this package is

The zero-container storage provider. FileSystemFixture creates a unique temp sandbox directory (Path.GetTempPath() + prefix + IsolationKey) and cleans it up on dispose. PathSandboxHelper.Resolve (root, relative) ensures the resolved path stays inside the root — throws on ../ traversal attempts. This is the foundation for safe per-test filesystem manipulation.

When to use it

  • Fast-path storage testing without Docker.
  • Testing code that writes / reads files (log rotation, report export, upload staging).
  • Regression-guarding path-traversal security boundaries.
  • Not for: cloud-storage semantic testing — use .S3, .AzureBlob, or .MinIO.

Prerequisites

  • .NET 10 SDK
  • System.IO.Abstractions (transitive)
  • Write access to Path.GetTempPath() on the test host.

Quick start

using Rig.TUnit.Storage.FileSystem.Fixtures;

await using var fx = new FileSystemFixture();
await fx.InitializeAsync();

var path = Path.Combine(fx.Root, "greeting.txt");
await File.WriteAllTextAsync(path, "hello");

Options

Property Type Default Description
RootPathPrefix string "rigtunit-fs" Temp-dir prefix
CleanupOnDispose bool true Recursively delete sandbox on dispose
UseMockFileSystem bool false Use MockFileSystem instead of real disk

Section name: RigTUnit:FileSystem.

Fixture + helper APIs

  • Rig.TUnit.Storage.FileSystem.Fixtures.FileSystemFixture
  • Rig.TUnit.Storage.FileSystem.Options.FileSystemFixtureOptions
  • Rig.TUnit.Storage.FileSystem.Builder.FileSystemRigBuilder
  • Rig.TUnit.Storage.FileSystem.Helpers.PathSandboxHelper

Per-test isolation

Each fixture owns a unique temp directory {TempPath}/{prefix}- {IsolationKey}. Teardown deletes recursively. PathSandboxHelper ensures resolved paths stay inside the sandbox.

Parallelism + performance

  • Zero container.
  • Fixture construction: ~2 ms (directory create).
  • Teardown: ~5 ms for typical test-size directory.
  • Safe under full parallelism.

Troubleshooting

  • UnauthorizedAccessException: path escapes sandbox — exactly what you want — PathSandboxHelper caught a traversal. Fix the test or input validation at the callsite.
  • Files remain after testCleanupOnDispose=false was set, or the test crashed before Dispose. Temp cleanup is a safety net, not a guarantee; prefer explicit using / await using.

See docs/troubleshooting.md#filesystem.

Provider quirks + edge cases

  • Path separators: PathSandboxHelper normalises to OS-native separators internally; relative path inputs should use / for portability.
  • UseMockFileSystem=true switches to MockFileSystem from System.IO.Abstractions.TestingHelpers — no real disk I/O, useful for speed but diverges on edge cases (file locking, case-sensitivity).

Benchmarks

See FileSystemBenchmarks.cs; baseline in benchmarks/baseline-005.json.

License

MIT. See LICENSE.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Rig.TUnit.Storage.FileSystem:

Package Downloads
Rig.TUnit.All

Meta-package containing every Rig.TUnit.* package. DISCOURAGED — prefer per-feature or per-stack meta-packages (Rig.TUnit, Rig.TUnit.Microservices).

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-beta.2 44 4/27/2026
0.0.0-alpha.0.14 45 4/26/2026