VOOZH about

URL: https://www.nuget.org/packages/Rig.TUnit.Microservices.Snapshots/

⇱ NuGet Gallery | Rig.TUnit.Microservices.Snapshots 0.1.0-beta.2




Rig.TUnit.Microservices.Snapshots 0.1.0-beta.2

This is a prerelease version of Rig.TUnit.Microservices.Snapshots.
dotnet add package Rig.TUnit.Microservices.Snapshots --version 0.1.0-beta.2
 
 
NuGet\Install-Package Rig.TUnit.Microservices.Snapshots -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.Microservices.Snapshots" 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.Microservices.Snapshots" Version="0.1.0-beta.2" />
 
Directory.Packages.props
<PackageReference Include="Rig.TUnit.Microservices.Snapshots" />
 
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.Microservices.Snapshots --version 0.1.0-beta.2
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Rig.TUnit.Microservices.Snapshots, 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.Microservices.Snapshots@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.Microservices.Snapshots&version=0.1.0-beta.2&prerelease
 
Install as a Cake Addin
#tool nuget:?package=Rig.TUnit.Microservices.Snapshots&version=0.1.0-beta.2&prerelease
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Rig.TUnit.Microservices.Snapshots

Snapshot-testing assertion compatible with Verify.TUnit file naming, with microservice-opinionated scrubbers.

What this package is

A lightweight snapshot-testing harness compatible with Verify.TUnit file-naming convention ({name}.received.* / {name}.verified.*). What it adds on top is an opinionated, microservice-shaped scrubber pipeline: correlation/causation IDs, event IDs, timestamps, sequence numbers, connection strings, and filesystem paths become deterministic placeholders before comparison. Without this, every snapshot test would drift on every run.

When to use it

  • Asserting the exact JSON shape of a REST / gRPC response.
  • Verifying event-envelope layouts match the documented contract.
  • Regression-guarding refactors that should preserve output byte-for-byte.
  • Not for: live file-system state — SnapshotAssert is for structured value comparison.

Prerequisites

  • .NET 10 SDK
  • Verify.TUnit (transitive)

Quick start

using Rig.TUnit.Microservices.Snapshots;

var payload = new { Id = Guid.NewGuid(), At = DateTimeOffset.UtcNow, Total = 42 };
var result = await SnapshotAssert.MatchJson(
 payload, name: "order-created", directory: "__snapshots__");

Options

Property Type Default Description
AutoVerify bool false First-run auto-create {name}.verified.* (off by default — review)
ScrubExtraPatterns string[]? null Extra regex patterns to scrub beyond defaults
DiffOnFailure bool true Include line-diff in exception message

Fixture + helper APIs

  • Rig.TUnit.Microservices.Snapshots.SnapshotAssert
  • Rig.TUnit.Microservices.Snapshots.Scrubbers.DefaultScrubbers
  • Rig.TUnit.Microservices.Snapshots.Options.SnapshotOptions

Per-test isolation

Snapshot files are named by the name argument + the test file's directory — tests cannot collide by design. Verify.TUnit's naming convention is preserved.

Parallelism + performance

  • Per-assertion: ~1 ms for a ~1 KB payload (serialise + scrub + file compare).
  • Safe under full parallelism — file I/O is per-test scoped.

Troubleshooting

  • Snapshot drifts every run — a scrubber missed a volatile field. Add it via ScrubExtraPatterns or file a bug if it looks like a common shape.
  • SnapshotAssertionException — inspect the .received.* file side-by-side with .verified.*; the exception message includes a line-diff by default.

See .

Provider quirks + edge cases

  • Default scrubbers: GUID, ISO-8601 timestamp, CorrelationId / CausationId values, EventId / MessageId, Sequence numeric, SQL Server connection strings, Windows/Unix absolute paths. Each is replaced with a deterministic placeholder.
  • Scrubbers are applied in order; later scrubbers see placeholders written by earlier ones.
  • JSON property order is preserved — snapshot mismatches triggered by reordering are considered intentional.

Benchmarks

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

Related docs

  • Sibling:

License

MIT. See .

Product Versions Compatible and additional computed target framework versions.
.NET net10.0 net10.0 is compatible.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows 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 (2)

Showing the top 2 NuGet packages that depend on Rig.TUnit.Microservices.Snapshots:

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).

Rig.TUnit.Microservices

Meta-package: Core + Mediator + Grpc + Outbox + Tracing + Jwt + Seq — the opinionated microservice testing kit.

GitHub repositories

This package is not used by any popular GitHub repositories.

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