Rig.TUnit.Storage.FileSystem
0.1.0-beta.2
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
<PackageReference Include="Rig.TUnit.Storage.FileSystem" Version="0.1.0-beta.2" />
<PackageVersion Include="Rig.TUnit.Storage.FileSystem" Version="0.1.0-beta.2" />
<PackageReference Include="Rig.TUnit.Storage.FileSystem" />
paket add Rig.TUnit.Storage.FileSystem --version 0.1.0-beta.2
#r "nuget: Rig.TUnit.Storage.FileSystem, 0.1.0-beta.2"
#:package Rig.TUnit.Storage.FileSystem@0.1.0-beta.2
#addin nuget:?package=Rig.TUnit.Storage.FileSystem&version=0.1.0-beta.2&prerelease
#tool nuget:?package=Rig.TUnit.Storage.FileSystem&version=0.1.0-beta.2&prerelease
Rig.TUnit.Storage.FileSystem
In-process filesystem fixture on
System.IO.Abstractionswith traversal-safePathSandboxHelper. 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.FileSystemFixtureRig.TUnit.Storage.FileSystem.Options.FileSystemFixtureOptionsRig.TUnit.Storage.FileSystem.Builder.FileSystemRigBuilderRig.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 —PathSandboxHelpercaught a traversal. Fix the test or input validation at the callsite.- Files remain after test —
CleanupOnDispose=falsewas set, or the test crashed beforeDispose. Temp cleanup is a safety net, not a guarantee; prefer explicitusing/await using.
See docs/troubleshooting.md#filesystem.
Provider quirks + edge cases
- Path separators:
PathSandboxHelpernormalises to OS-native separators internally; relative path inputs should use/for portability. UseMockFileSystem=trueswitches toMockFileSystemfromSystem.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.
Related docs
- Architecture diagram
- Glossary
- Family base:
Rig.TUnit.Storage
License
MIT. See LICENSE.
| Product | Versions 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. |
-
net10.0
- Bogus (>= 35.6.1)
- Microsoft.Extensions.Configuration (>= 10.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Options (>= 10.0.0)
- Microsoft.Extensions.Options.DataAnnotations (>= 10.0.0)
- Rig.TUnit.Storage (>= 0.1.0-beta.2)
- System.IO.Abstractions (>= 21.1.3)
- TUnit.Core (>= 1.34.5)
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 |