Verify
CLAUDE.md3.5k starsChanged 11 months agoMITView on GitHub
Verify is a snapshot testing framework for .NET that simplifies assertion of complex data models and documents. It serializes test results to .verified.* files and compares them against actual results on subsequent runs. Solution file: src\Verify.slnx (uses modern .slnx format) Always pass src/Verify.slnx explicitly to dotnet build. There are multiple .slnx files in src/ and omitting the solution file causes ambiguity errors. global.json sets "test": { "runner": "Microsoft.Testing.Platform" }, so dotnet test runs in MTP mode. Test projects follow these…
Trending
More talk lately.about the whole repository
Who's talking about VerifyTests/Verify
- @simoncropp.bsky.social“anyone using Verify for snapshot testing and want a review of how you are using it? github.com/VerifyTests/...”Bluesky · Apr 17, 2025 · 12 likes
- @dennisdoomen.com“If you're using github.com/VerifyTests/..., e.g. to protect your library's public API, also check out …”Bluesky · Sep 6, 2025 · 8 likes
- github/gitignore“Added Approval Tests result files”GitHub · Jul 2, 2022 · 4 reactions
- @duendesoftware.com“Duende is now sponsoring Verify (github.com/VerifyTests/...), the powerful #dotnet snapshot testing library …”Bluesky · Apr 9, 2026 · 3 likes
- Stack Overflow“VerifyTest fails with line endings error message”Stack Overflow · Jul 29, 2026 · 2 votes
The biggest 5 of 64 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 64
Talked about on GitHub, Stack Overflow and Bluesky (64 times).
On GitHub · 50
- Jul 2, 2022Added Approval Tests result files — github/gitignore4 reactions · 5 comments
- Apr 20, 2026Sanitize attachment filenames against cross-platform invalid chars — xunit/xunit2 reactions · 6 comments
- Jul 26, 2022Proposal: add snapshot testing — MoienTajik/AspNetCore-Developer-Roadmapsays it tested it2 reactions · 2 comments
- Jun 28, 2020Verify — dotnet-foundation/projects2 reactions · 7 comments
- Nov 13, 2025[SourceGen] Improve snapshot testing in source generator unit tests — dotnet/mauisays it tested it1 reaction
45 more on GitHub
- Apr 18, 2025apply verify conventions — thomhurst/TUnit1 reaction
- Feb 17, 2025Bump the xunit group across 1 directory with 4 updates — kusl/fluentassertions1 reaction · 9 comments
- Feb 17, 2025Bump Verify.Xunit from 28.10.1 to 28.11.0 in the xunit group — fluentassertions/fluentassertions1 reaction · 3 comments
- Feb 10, 2025Bump NUnit and Verify.NUnit — quartznet/quartznet1 reaction · 1 comment
- Feb 10, 2025Bump the xunit group across 1 directory with 4 updates — kusl/fluentassertions1 reaction · 2 comments
- Feb 10, 2025Bump the xunit group with 3 updates — fluentassertions/fluentassertions1 reaction · 4 comments
- Jan 20, 2025Bump the xunit group across 1 directory with 2 updates — kusl/fluentassertions1 reaction · 2 comments
- Jan 16, 2025Bump Verify.Xunit from 28.8.1 to 28.9.0 in the xunit group — fluentassertions/fluentassertions1 reaction · 3 comments
- Jan 14, 2025Bump Verify.Xunit from 28.8.1 to 28.9.0 in the xunit group — kusl/fluentassertions1 reaction · 2 comments
- Jan 6, 2025Bump Verify.Xunit from 28.7.1 to 28.8.1 in the xunit group — fluentassertions/fluentassertions1 reaction · 3 comments
- Jan 6, 2025Bump Verify.Xunit from 28.7.0 to 28.7.1 — henrikwidlund/unfoldedcircle-oppo1 reaction · 2 comments
- Jan 5, 2025Bump Verify.Xunit from 28.7.0 to 28.7.1 in the xunit group — fluentassertions/fluentassertions1 reaction · 3 comments
- Dec 23, 2024Bump NUnit and Verify.NUnit — MrKWatkins/Sesharp1 reaction · 1 comment
- Dec 23, 2024Bump Verify.Xunit from 28.6.0 to 28.7.0 in the xunit group — fluentassertions/fluentassertions1 reaction · 3 comments
- Dec 19, 2024Bump NUnit and Verify.NUnit — MrKWatkins/Sesharp1 reaction
- Dec 18, 2024Bump the xunit group with 3 updates — fluentassertions/fluentassertions1 reaction · 3 comments
- Dec 17, 2024Bump NUnit and Verify.NUnit — MrKWatkins/Sesharp1 reaction · 1 comment
- Dec 16, 2024Bump Verify.Xunit from 28.4.0 to 28.5.0 in the xunit group — fluentassertions/fluentassertions1 reaction · 3 comments
- Dec 9, 2024Bump Verify.Xunit from 28.3.2 to 28.4.0 in the xunit group — fluentassertions/fluentassertions1 reaction · 3 comments
- Nov 18, 2024Bump Verify.Xunit from 28.2.0 to 28.3.2 in the xunit group — fluentassertions/fluentassertions1 reaction · 3 comments
- Nov 11, 2024Bump NUnit and Verify.NUnit — quartznet/quartznet1 reaction · 1 comment
- Nov 11, 2024Bump Verify.Xunit from 28.1.3 to 28.2.0 in the xunit group — fluentassertions/fluentassertions1 reaction · 3 comments
- Nov 4, 2024Bump NUnit and Verify.NUnit — quartznet/quartznet1 reaction · 1 comment
- Nov 4, 2024Bump the xunit group with 2 updates — fluentassertions/fluentassertions1 reaction · 2 comments
- Oct 28, 2024Bump Verify.NUnit from 27.0.1 to 27.1.0 — quartznet/quartznet1 reaction · 1 comment
- Oct 28, 2024Bump the xunit group with 2 updates — fluentassertions/fluentassertions1 reaction · 2 comments
- Oct 14, 2024Bump Verify.NUnit from 26.6.0 to 27.0.1 — quartznet/quartznet1 reaction · 1 comment
- Oct 14, 2024Bump the xunit group with 3 updates — fluentassertions/fluentassertions1 reaction · 3 comments
- Sep 23, 2024Bump Verify.NUnit from 26.4.5 to 26.6.0 — quartznet/quartznet1 reaction · 1 comment
- Sep 23, 2024Bump the xunit group with 3 updates — fluentassertions/fluentassertions1 reaction · 3 comments
- Sep 16, 2024Bump the xunit group with 2 updates — fluentassertions/fluentassertions1 reaction · 2 comments
- Sep 9, 2024Bump Verify.NUnit from 26.3.1 to 26.4.2 — quartznet/quartznet1 reaction · 1 comment
- Sep 9, 2024Bump the xunit group with 2 updates — fluentassertions/fluentassertions1 reaction · 2 comments
- Sep 2, 2024Bump Verify.NUnit and NUnit — quartznet/quartznet1 reaction · 1 comment
- Sep 2, 2024Bump the xunit group with 2 updates — fluentassertions/fluentassertions1 reaction · 2 comments
- Aug 12, 2024Bump Verify.NUnit from 26.1.6 to 26.2.0 — quartznet/quartznet1 reaction · 1 comment
- Aug 12, 2024Bump the xunit group with 2 updates — fluentassertions/fluentassertions1 reaction · 1 comment
- Aug 5, 2024Bump Verify.NUnit from 26.1.5 to 26.1.6 — quartznet/quartznet1 reaction · 1 comment
- Jul 29, 2024Bump Verify.NUnit from 26.0.0 to 26.1.5 — quartznet/quartznet1 reaction · 1 comment
- Jul 22, 2024Bump Verify.NUnit from 25.3.1 to 26.0.0 — quartznet/quartznet1 reaction · 1 comment
- Jul 5, 2024mark verified files as lf and utf8 — dotnet/winforms1 reaction · 1 comment
- Sep 15, 2021JsonSourceGenerator cannot be created in VS2019 preview — dotnet/sdk1 reaction · 11 comments
- Nov 10, 2026Renew the Verify open-source exemption before 2027-11 — janset2d/sdl2-cs-bindings0 reactions
- Oct 25, 2026build: upgrade Verify.MSTest to 33.x (needs SponsorCheck license) — wouterfennis/TimeForCode0 reactions
- Oct 3, 2026Directory.Packages.props declares four packages that no project references — AdCodicem/AdCodicem.ValueObjects0 reactions
On Stack Overflow · 11
- Jul 29, 2026VerifyTest fails with line endings error message2 votes
- Aug 23, 2022Is there a way to scrub a value for a specific property?2 votes
- Jul 20, 2024Verify.Attributes.cs(14,12): Error CS0579 : Duplicate 'VerifyXunit.UseVerifyAttribute' attribute1 vote
- Jun 4, 2023Why is my Verify.Bunit test failing and not producing a received file?1 vote
- Dec 14, 2022Is there a way to scrub (inline) Guids from JSON properties?1 vote
6 more on Stack Overflow
- Jun 12, 2022CombinationApprovals.VerifyAllCombinations equiavalent using Verify?1 vote · 1 answer
- Feb 21, 2022Does "VerifyTests / Verify" have global settings?1 vote · 2 answers
- Oct 10, 2021UTF-8 BOM in received-files from Verify1 vote · 1 answer
- Nov 18, 2024VerifyTests XML CData and Comments removed0 votes
- Oct 30, 2024CombinationApprovals.VerifyAllCombinations equiavalent using Verify?0 votes
- Mar 2, 2024VerifyTests has BuildServer difference: [CallerFilePath] string? path = null0 votes
On Bluesky · 3
- Apr 17, 2025anyone using Verify for snapshot testing and want a review of how you are using it? github.com/VerifyTests/... — @simoncropp.bsky.socialsays it tested it12 likes and reposts · 3 replies
- Sep 6, 2025If you're using github.com/VerifyTests/..., e.g. to protect your library's public API, also check out plugins.jetbrains.com/plugin/17240...… — @dennisdoomen.com8 likes and reposts
- Apr 9, 2026Duende is now sponsoring Verify (github.com/VerifyTests/...), the powerful #dotnet snapshot testing library we use to protect the API… — @duendesoftware.comsays it tested it3 likes and reposts
The file
Show its rules and text
We split this claude.md into the rules it gives an agent
14 rules. About 0 are common, 1 is distinctive, and 13 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
13
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 7
Verify is a snapshot testing framework for .NET that simplifies assertion of complex data models and documents.
- Very specific: line 33
Instead, build once and run each test project individually.
- Very specific: line 186
Verify files should use:
- Very specific: line 219
Create new project (e.g., Verify.NewFramework)
- Very specific: line 221
Create partial Verifier classes for each verification method (Object, String, Stream, etc.)
- Distinctive: line 222
Add MSBuild props file to inject any required attributes/configuration
- Very specific: line 229
Create converter class implementing appropriate interface in src/Verify/Serialization/Converters/
- Very specific: line 245
Single-target naming: When a test project targets a single framework (e.g., StaticSettingsTests), the .received.
- Very specific: line 280
Snapshot File Nesting: Verify includes MSBuild props that nest snapshot files under test files in IDE.
- Very specific: line 282
TUnit Tests: Use dotnet run instead of dotnet test for TUnit projects.
- Very specific: line 284
Tool Restoration: Run dotnet tool restore before running Fixie tests (requires fixie.console tool).
- Very specific: line 286
New Test Projects: Do not add Microsoft.NET.Test.Sdk to an MTP test project, and remember <OutputType>Exe</OutputType> plus the runner …
- Very specific: line 299
Run mdsnippets to regenerate (globally installed dotnet tool)
- Very specific: line 315
When a Verify test fails, VerifyExceptionMessageBuilder (src/Verify/Verifier/VerifyExceptionMessageBuilder.cs) produces a structured, …
≈ “Common” is an estimate: at least 1 in 5 of the 27,641 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Overview
Verify is a snapshot testing framework for .NET that simplifies assertion of complex data models and documents. It serializes test results to .verified.* files and compares them against actual results on subsequent runs.
Solution file: src\Verify.slnx (uses modern .slnx format)
Build & Test Commands
Always pass src/Verify.slnx explicitly to dotnet build. There are multiple .slnx files in src/ and omitting the solution file causes ambiguity errors.
# Build the whole solution
dotnet build src/Verify.slnxTest runner setup (Microsoft.Testing.Platform)
global.json sets "test": { "runner": "Microsoft.Testing.Platform" }, so dotnet test runs in MTP mode. Test projects follow these conventions:
- No
Microsoft.NET.Test.Sdkin xUnit v3, NUnit, MSTest or TUnit projects. It only exists for VSTest. The only project that still references it isVerify.Fixie.Tests, which uses VSTest. The Expecto projects don't reference it either: they are console executables run viadotnet run. <OutputType>Exe</OutputType>is required in every MTP test project.Microsoft.NET.Test.Sdkused to set it implicitly; without it xunit.v3 fails the build ("xUnit.net v3 test projects must be executable"). TUnit sets it itself.- Runner opt-in: NUnit projects need
<EnableNUnitRunner>true</EnableNUnitRunner>and MSTest projects need<EnableMSTestRunner>true</EnableMSTestRunner>. xUnit v3 and TUnit are MTP apps without any opt-in. <RootNamespace>Fake</RootNamespace>in NUnit/MSTest projects stops the generated MTP entry point introducing aVerifynamespace that shadows theVerify()method.
Running the full test suite
Because Verify.Fixie.Tests still uses the VSTest runner, dotnet test src/Verify.slnx does not work — it aborts with a mixed-runner error ("All projects must use that test runner") before running anything. There is no single command that runs every test project.
Instead, build once and run each test project individually. .github/workflows/build.yml is the source of truth for the complete, ordered list and how each project is invoked. The commands differ by runner:
# Build once in the target configuration, then run with --no-build --no-restore
dotnet build src/Verify.slnx -c Release
# Most projects (xUnit v3, NUnit, MSTest) run via `dotnet test`.
# Multi-targeted projects need an ABSOLUTE path: `dotnet test` re-resolves a relative
# project/directory path against the project directory, giving
# "src/X/src/X/X.csproj could not be found".
dotnet test $PWD/src/Verify.Tests -c Release --no-build --no-restore
dotnet test $PWD/src/Verify.NUnit.Tests -c Release --no-build --no-restore
# Expecto (F#) and TUnit projects are console executables — run via `dotnet run`
dotnet run --project src/Verify.Expecto.Tests -c Release --no-build --no-restore
dotnet run --project src/Verify.TUnit.Tests/Verify.TUnit.Tests.csproj -c Release --no-build --no-restore
# Fixie has no MTP runner — run via the fixie.console tool from the `src` directory
# (first: dotnet tool restore --tool-manifest src/.config/dotnet-tools.json)
cd src && dotnet fixie Verify.Fixie.Tests -c Release --no-buildsrc/VerifyDangling.slnx (the DanglingSnapshots*Usage projects) is built separately by CI; its tests are not run.
Running a single test
MTP does not accept the VSTest --filter "FullyQualifiedName~..." syntax. For xUnit v3 projects, either pass xUnit's MTP filters through dotnet test (use -f to pick one framework):
dotnet test $PWD/src/Verify.Tests -c Release --no-build --no-restore -f net9.0 --filter-method "*NotInlineRetiresTheCallSite*"or build the project for a single framework and run the compiled test executable directly with the xUnit v3 -class / -method filters (leading/trailing * wildcard supported):
dotnet build src/Verify.Tests/Verify.Tests.csproj -f net11.0 -c Debug
src/Verify.Tests/bin/Debug/net11.0/Verify.Tests.exe -class "PluginConventionTests"
src/Verify.Tests/bin/Debug/net11.0/Verify.Tests.exe -method "*StaleUnreferencedPluginIsSkipped*"Common Test Projects
Verify.Tests- Core verification engine testsVerify.Xunit.Tests/Verify.XunitV3.Tests- xUnit adapter testsVerify.NUnit.Tests- NUnit adapter testsVerify.MSTest.Tests- MSTest adapter testsVerify.Fixie.Tests- Fixie adapter testsVerify.Expecto.Tests/Verify.Expecto.FSharpTests- Expecto (F#) adapter testsVerify.TUnit.Tests- TUnit adapter testsDeterministicTests- Deterministic serialization testsStaticSettingsTests- Global configuration testsStrictJsonTests- JSON parsing tests
Tool Installation
# Restore dotnet tools (required for Fixie tests)
dotnet tool restore --tool-manifest src/.config/dotnet-tools.jsonArchitecture
Three-Layer Design
- Test Framework Adapters (
Verify.NUnit,Verify.Xunit,Verify.MSTest, etc.)- Extract test metadata (type name, method name, parameters) from framework context
- Implement
BuildVerifier()to createInnerVerifierinstances - Each adapter is framework-specific but follows the same pattern
- Core Verification Engine (
Verifyproject)InnerVerifier- Orchestrates verification workflow (split across 12 partial files by data type)VerifyEngine- Comparison logic, diff tool launching, callback executionSettingsTask- Fluent builder API for configuration
- Serialization & Comparison
VerifyJsonWriter- Custom JSON writer extending Argon librarySerializationSettings- Registry of converters and scrubbersComparer/FileComparer/StreamComparer- Different comparison strategies
Key Design Patterns
Adapter Pattern: Each test framework has a minimal adapter that extracts framework metadata differently:
- Xunit: Uses
UseVerifyAttribute(aBeforeAfterTestAttribute) injected via MSBuild - NUnit: Direct access to
TestContext.CurrentContext.Test - MSTest: Requires
[UsesVerify]attribute with source generator - Fixie: Uses
ExecutionState.Current
Partial Classes: InnerVerifier is split across 12 files:
InnerVerifier_Object.cs- Object serializationInnerVerifier_String.cs- Text comparisonInnerVerifier_Stream.cs- Binary filesInnerVerifier_Json.cs- JSON handlingInnerVerifier_Xml.cs- XML serializationInnerVerifier_Archive.cs- ZIP filesInnerVerifier_Directory.cs- Directory treesInnerVerifier_File.cs- Individual filesInnerVerifier_Task.cs- Async unwrappingInnerVerifier_Throws.cs- Exception capture- And others...
Builder Pattern: SettingsTask provides fluent API with ~50 configuration methods that are lazily evaluated at verification time.
Source and derived targets: A converter can say which of its targets is the document and which were computed from it (ConversionResult(info, source, derived), or the PagedConversion builder for documents with pages, both in src/Verify/Splitters/):
InnerVerifier.Adopt(InnerVerifier_Stream.cs) is the only place aConversionTokenis created. It stamps the targets of a conversion, names them relative to the target that was converted, and marks the source, which is never converted again.VerifyEngine.HandleResultsdecides every file name first (Plan), compares sources ahead of the rest (CompareOrder, so a differing source makes its derived targets bypass their comparers), and hands results on in planned order, which is the order callbacks and the exception message have always used.VerifyEngine.Reportruns once, after the delete/new/not-equal callbacks, and is the only caller of DiffEngine for pending files: deletes that stand alone, moves that stand alone (sources among them), moves derived from a pending source (DiffRunner.LaunchDerived*), then deletes derived from one. Test seams:VerifyEngine.LaunchDiffandRaisedDeletes.AddDelete.- The settings a paged converter reads (
PageText,PagesToInclude,ExcludeDerivedTargets) follow theExcludeTargetspattern: a static onVerifierSettings, aContextkey onVerifySettings, aSettingsTaskwrapper, and a reader on the converter'scontext. - User and plugin-author docs:
docs/paged-documents.mdand the "Source and derived targets" section ofdocs/converter.md.
Counter Pattern: Deduplicates repeated values in filenames:
- First occurrence:
Date, second:Date_1, third:Date_2, etc. - Separate counters for DateTime, DateTimeOffset, Guid, etc.
File Naming Convention
Format: {TypeName}.{MethodName}_{Parameters}_{UniqueFor}.{Status}.{Extension}
Example: MyTests.MyTest_param1_param2.verified.txt
Key components:
Namer.cs- Central naming logic with "unique for" variants (runtime, framework, etc.)FileNameBuilder.cs- Builds filename segments from test metadataParameterToName- Converts parameters to filename-safe stringsFileNameCleaner.cs- Removes invalid characters (: * ? / < > |)
Critical Code Locations
- Verification flow:
src/Verify/Verifier/VerifyEngine.cs(main orchestrator) - Serialization:
src/Verify/Serialization/VerifyJsonWriter.csandSerializationSettings.cs - Comparison logic:
src/Verify/Compare/Comparer.cs - File naming:
src/Verify/Naming/FileNameBuilder.cs - Test adapter examples:
src/Verify.Xunit/Verifier.cs,src/Verify.NUnit/Verifier.cs
Important Conventions
Snapshot Files
- Exclude from source control: All
*.received.*files (mismatches during test runs) - Include in source control: All
*.verified.*files (approved snapshots) - File characteristics: UTF-8 with BOM, LF line endings, no trailing newline
.gitattributes Requirements
*.received.*
*.verified.txt text eol=lf working-tree-encoding=UTF-8
*.verified.xml text eol=lf working-tree-encoding=UTF-8
*.verified.json text eol=lf working-tree-encoding=UTF-8
*.verified.bin binaryEditorConfig Settings
Verify files should use:
charset = utf-8-bomend_of_line = lfinsert_final_newline = false
Project Structure
src/
├── Verify/ # Core library
│ ├── Verifier/ # Verification engine
│ ├── Naming/ # File naming logic
│ ├── Serialization/ # JSON serialization & converters
│ ├── Compare/ # Comparison strategies
│ ├── Recording/ # Data recording during tests
│ ├── Combinations/ # Cartesian product testing
│ ├── DerivePaths/ # Build metadata integration
│ └── buildTransitive/ # MSBuild props/targets
├── Verify.NUnit/ # NUnit adapter
├── Verify.XunitV3/ # xUnit v3 adapter
├── Verify.MSTest/ # MSTest adapter
├── Verify.MSTest.SourceGenerator/ # Code generation for MSTest
├── Verify.Fixie/ # Fixie adapter
├── Verify.Expecto/ # Expecto (F#) adapter
├── Verify.TUnit/ # TUnit adapter
├── [Various test projects]
└── .config/dotnet-tools.json # Local tool manifestDevelopment Workflow
Adding a Test Framework Adapter
- Create new project (e.g.,
Verify.NewFramework) - Implement
BuildVerifier()to extract test context from framework - Create partial
Verifierclasses for each verification method (Object, String, Stream, etc.) - Add MSBuild props file to inject any required attributes/configuration
- Optionally add module initializer to register test attachment callbacks
Reference existing adapters like Verify.Xunit/Verifier.cs or Verify.NUnit/Verifier.cs.
Extending Serialization
- Create converter class implementing appropriate interface in
src/Verify/Serialization/Converters/ - Register via
VerifierSettings.AddSerializer<T>(converter)in module initializer - Converters can access
SerializationSettingsfor configuration
Modifying File Naming
- Primary logic in
src/Verify/Naming/FileNameBuilder.cs - Parameter conversion in
src/Verify/Naming/ParameterToName.cs - Sanitization in
src/Verify/FileNameCleaner.cs
Accepting New Snapshots
When tests fail, .received.* files are created showing actual output. To accept a new snapshot, copy the .received.* file to the path on the Verified: line of the exception message. Do not derive the verified name from the received name — the two are not always the same.
Multi-target naming: When a test project targets multiple frameworks (e.g., Verify.Tests), the .received. file always carries a runtime and version suffix (e.g., .DotNet11_0.received.txt). The .verified. file carries whatever UniqueFor* the test asked for, which may be nothing (.verified.txt), the runtime (.DotNet.verified.txt), or the same runtime and version (.DotNet11_0.verified.txt).
Single-target naming: When a test project targets a single framework (e.g., StaticSettingsTests), the .received. file uses the same uniqueness as its .verified. file, including any UniqueForRuntime/UniqueForRuntimeAndVersion suffix.
Parameters: Ignored parameters (IgnoreParameters, IgnoreParametersForVerified, IgnoreConstructorParameters) are kept in the .received. name and dropped from the .verified. name, regardless of how many frameworks are targeted.
Debugging Tests
On CI (GitHub Actions), failed test artifacts are uploaded for inspection.
Multi-Targeting
The solution supports:
- .NET Framework: net462, net472, net48 (Windows only)
- .NET: net6.0, net7.0, net8.0, net9.0, net10.0, net11.0
SDK version: 11.0 preview (see src/global.json)
Platform-specific code uses conditional compilation:
#if NET6_0_OR_GREATER
// Modern .NET code
#endif
#if NET8_0_OR_GREATER
// .NET 8+ optimizations (e.g., SearchValues<T>)
#endifCommon Gotchas
- Module Initializers: Global configuration via
VerifierSettingsmust be done in a module initializer ([ModuleInitializer]) before any tests run. - MSTest Requires Opt-in: MSTest tests need
[UsesVerify]attribute on class/assembly, or inherit fromVerifyBase. - Fixie Requires Custom Convention: Fixie needs
ITestProjectandIExecutionimplementations that callVerifierSettings.AssignTargetAssembly()andExecutionState.Set(). - Snapshot File Nesting: Verify includes MSBuild props that nest snapshot files under test files in IDE. Disable with
<DisableVerifyFileNesting>true</DisableVerifyFileNesting>. - TUnit Tests: Use
dotnet runinstead ofdotnet testfor TUnit projects. - Tool Restoration: Run
dotnet tool restorebefore running Fixie tests (requires fixie.console tool). - New Test Projects: Do not add
Microsoft.NET.Test.Sdkto an MTP test project, and remember<OutputType>Exe</OutputType>plus the runner opt-in (see "Test runner setup"). WithoutMicrosoft.NET.Test.Sdk, the runner opt-in is what makesdotnet testtreat an NUnit/MSTest project as a test project.
Source Generator (MSTest)
The MSTest adapter includes a source generator at src/Verify.MSTest.SourceGenerator/ that generates code for tests marked with [UsesVerify]. This handles test context plumbing automatically.
Documentation Generation
README and docs are generated from source files using MarkdownSnippets:
- Source:
readme.source.md - Generated:
readme.md(DO NOT EDIT) - Doc sources:
docs/mdsource/*.source.md→docs/*.md(generated) - Includes:
docs/mdsource/*.include.md(reusable fragments) - Run
mdsnippetsto regenerate (globally installed dotnet tool)
Snippet Conventions
- Code snippets use
#region SnippetName/#endregionmarkers in source files - Referenced in docs as
snippet: SnippetName - Verified files can be included directly:
snippet: TestClass.Method.verified.txt src/ModuleInitDocs/contains purpose-built snippet classes for documentation (each file wraps a single#region)src/Verify.ExceptionParsing.Tests/ExceptionMessageFormatSamples.cscontains tests whose sole purpose is producing verified snapshots for the exception format docs
Content Validation
src/mdsnippets.json has ValidateContent: true. This forbids certain words (e.g., "you", "your") in .source.md files outside of fenced code blocks. Use third-person phrasing instead.
Exception Message Format
When a Verify test fails, VerifyExceptionMessageBuilder (src/Verify/Verifier/VerifyExceptionMessageBuilder.cs) produces a structured, machine-parsable exception message with sections: Directory:, New:, NotEqual:, Delete:, Equal:, and FileContent:. See docs/exception-message-format.md for the full format.
Verify.ExceptionParsing (src/Verify.ExceptionParsing/) is a separate library (published as a NuGet package) that parses these exception messages back into structured data.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

