Replace Verify with in-house generator snapshot assertions

Merged
JA
4d ago
+163-85

Summary

Verify 33.x (pulled in by #149) adds a SponsorCheck build gate that fails the build (SC021) unless a sponsorship/licence MSBuild property is declared. Verify was only used by the 14 source generator snapshot tests, so this replaces it with a small in-house helper and drops the dependency.

  • Add GeneratorSnapshot, which compares each generated source against the existing {Class}.{Test}#{HintName}.verified.cs files (unchanged), writes .received.cs on mismatch, flags stale snapshots, and fails on generator diagnostics or exceptions
  • Exclude *.verified.cs / *.received.cs from compilation in both test projects (previously done by Verify's MSBuild targets)
  • Remove Verify.NUnit / Verify.SourceGenerators and the Verify* Dependabot group pattern
  • Fix NativeCodecsTests.Initialize_WithEnableOptions_SetsProperties: enable options are applied before the native library is probed, so the library-unavailable branch asserted the wrong values (only reproducible where the native library is absent)

Testing

  • Solution builds with 0 warnings / 0 errors
  • Full test suite passes on net10.0 locally
  • Confirmed a deliberately altered snapshot fails with a clear message and writes a .received.cs file

After this merges, #149 only needs the NUnit 5 API fixes.


Summary by cubic

Verify 33.x adds a SponsorCheck build gate that fails the build unless a sponsorship MSBuild property is declared. Verify was only used for the 14 source generator snapshot tests, so this replaces it with a small in-house helper and drops the dependency.

  • Adds GeneratorSnapshot, which compares each generated source against the existing {Class}.{Test}#{HintName}.verified.cs files, writes .received.cs on mismatch, flags stale snapshots, and fails on generator diagnostics or exceptions.
  • Excludes *.verified.cs and *.received.cs from compilation in both test projects (previously handled by Verify's MSBuild targets).
  • Removes Verify.NUnit, Verify.SourceGenerators, and the Verify* Dependabot pattern.
  • Fixes NativeCodecsTests.Initialize_WithEnableOptions_SetsProperties: enable options are applied before the native library is probed, so the library-unavailable branch was asserting the wrong values.
  • Maps CI-recorded / _/ source paths back to the repository root, measured via a RepositoryRoot assembly metadata item, so snapshot files resolve in deterministic builds.