ISnapshotComparer Interface
Decides whether the snapshot produced by a test matches the verified snapshot. A comparer is registered for a SnapshotType in SnapshotComparerCollection.
public interface ISnapshotComparerMethods
| Name | Description |
|---|---|
| Equals(SnapshotData, SnapshotData) | Compares two snapshots. |
| Equals(SnapshotData, SnapshotData, string?) | Compares two snapshots and, when they do not match, describes why. |
Equals overloads
Equals(SnapshotData, SnapshotData)
Compares two snapshots.
bool Equals(SnapshotData expected, SnapshotData actual)Parameters
expectedSnapshotData- The verified snapshot.
actualSnapshotData- The snapshot produced by the test.
Returns
bool true when the snapshots match.
Equals(SnapshotData, SnapshotData, string?)
ISnapshotComparer.csCompares two snapshots and, when they do not match, describes why.
public bool Equals(SnapshotData expected, SnapshotData actual, out string? mismatchReason)Parameters
expectedSnapshotData- The verified snapshot.
actualSnapshotData- The snapshot produced by the test.
mismatchReasonstring?- When the snapshots do not match, a short description of the difference that is added to the assertion message (for example, the similarity score and the threshold it did not reach), or
nullwhen the comparer has nothing to add. Alwaysnullwhen the snapshots match.
Returns
bool true when the snapshots match.
Remarks
The default implementation calls ISnapshotComparer.Equals and gives no reason.