Namespace SnapshotAssertions
Classes
- DiffSuggestion
One scrubber recommendation surfaced by DiffSuggestionAnalyzer on a snapshot-mismatch diff. The analyzer scans the differing lines of the diff for known volatile patterns (GUID canonical, GUID N-format, ISO 8601 timestamps, Unix epoch milliseconds, elapsed milliseconds) and emits one suggestion per pattern that has at least one hit, ordered by hit count descending.
- DiffSuggestionAnalyzer
Scans the rendered diff from a snapshot mismatch for known volatile patterns (GUID, GUID N-format, ISO 8601 timestamp, Unix epoch milliseconds, elapsed ms) and surfaces DiffSuggestion entries recommending applicable built-in scrubbers. Pure: no IO, no allocation beyond the result list and the per-pattern match enumeration.
- LineDiffRenderer
Renders a simple per-line comparison between two strings for use in assertion failure messages. Output uses unified-diff-style line prefixes (
-for expected,+for actual) and is truncated to the first 20 differing lines so very large snapshots do not produce an overwhelming wall of text.
- Scrubbers
Built-in SnapshotScrubber factory. Each property returns a stateless instance (state lives in the per-call SnapshotScrubberState), so the same property may be reused across tests without cross-test interference.
- SnapshotAcceptMode
Detection of accept-mode based on the
SNAPSHOT_ACCEPTandCIenvironment variables. Pure, no IO; the caller is responsible for actually overwriting the baseline when accept-mode is active.
- SnapshotComparer
Pure string-against-string comparison with SnapshotOptions-driven normalization (line endings, BOM, trailing whitespace, trailing newline). Stateless and allocation-friendly; the heavy work of computing a per-line diff is deferred to LineDiffRenderer on mismatch.
- SnapshotEvaluator
Orchestrates a single snapshot comparison: reads the expected baseline from disk if present, compares against the actual content under the supplied options, applies accept-mode when active, and writes the normalized actual content to
.actual.txton failure. Every baseline-candidate is persisted in normalized form so an accepted baseline matches the form the comparison reads back.
- SnapshotException
Exception thrown by snapshot-assertion entry points when a comparison fails (mismatch or missing baseline). Carries the underlying SnapshotResult for programmatic access; the Message is the same human-readable form rendered by Describe().
- SnapshotFileResolver
Path resolution for snapshot files. Computes the expected file path given a directory and either an explicit name or a (test class, test method) pair, plus the matching
.actual.txtsibling path.
- SnapshotOptions
Configuration for snapshot comparison: line-ending handling, BOM behavior, trailing whitespace, and trailing-newline policy. Strict by default; opt into normalization explicitly via the convenience presets or by mutating the properties directly.
- SnapshotResult
The outcome of a snapshot comparison, including paths to the expected baseline and (on mismatch or no-baseline) the written actual file, plus a rendered line-based diff for failure messages.
- SnapshotScrubber
Base class for snapshot text transformations applied before comparison. A scrubber receives the actual content plus a per-snapshot SnapshotScrubberState and returns a transformed string in which volatile substrings (GUIDs, timestamps, epoch millis, etc.) have been replaced by stable tokens, so a snapshot baseline can survive multiple test runs.
- SnapshotScrubberState
Per-snapshot scrubber state. Maps each original volatile value (a specific GUID, a specific ISO 8601 timestamp, a specific Unix-millis number, etc.) to a stable index, so the same recurring value across the snapshot renders as the same indexed token. State lives for the duration of a single
MatchesSnapshot()evaluation and is discarded afterwards.
Structs
- SnapshotPaths
The pair of paths a snapshot comparison reads from and writes to.
Enums
- SnapshotBomHandling
How a leading byte-order-mark is handled during snapshot comparison.
- SnapshotLineEndingMode
How line-ending differences between actual and expected content are handled during snapshot comparison.
- SnapshotMatchOutcome
The classification of a snapshot comparison outcome.
- SnapshotTrailingNewline
How the trailing newline at end-of-file is treated during snapshot comparison.
- SnapshotTrailingWhitespace
How per-line trailing whitespace is treated during snapshot comparison.