Extensions

edit

The extension packages add serializers, comparers and converters to SnapshotSettings for values that a text or a byte comparison does not handle well. Each one has a single setup method, to call once on SnapshotSettings.Default in a module initializer.

PackageSetupUse it to
Meziantou.Framework.SnapshotTesting.ImagingAddImaging()Compare images by their pixels, exactly or by similarity, and store the frames of GIF and ICO files as PNG snapshots. See Images
Meziantou.Framework.SnapshotTesting.PdfAddPdf()Store a PDF document as one PNG image per page and a JSON file of metadata. See PDF documents
Meziantou.Framework.SnapshotTesting.RoslynAddRoslyn()Validate source generator results, syntax trees and diagnostics. See Roslyn

Register them once for the whole test assembly, not inside a test method. SnapshotSettings.Default is shared by every test of the process: registering from a test races against the tests that are serializing a snapshot at the same time, and repeated calls add the serializers and converters again every time.

To write your own extension, see Serializers and comparers.