Class SnapshotComparer
- Namespace
- SnapshotAssertions
- Assembly
- SnapshotAssertions.dll
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.
public static class SnapshotComparer
- Inheritance
-
SnapshotComparer
- Inherited Members
Methods
AreEqual(string, string, SnapshotOptions)
Compares actual against expected under
options. Returns true if the two are considered
equal under the option-driven normalization rules; otherwise false.
public static bool AreEqual(string actual, string expected, SnapshotOptions options)
Parameters
actualstringThe actual content produced by the test.
expectedstringThe expected baseline content.
optionsSnapshotOptionsThe comparison options. Required (use Default for strict-default semantics).
Returns
Exceptions
- ArgumentNullException
A required argument is null.
Normalize(string, SnapshotOptions)
Applies the option-driven normalization to content and returns the
result. Exposed for diff rendering, which needs to render the same normalized form
the equality check used.
public static string Normalize(string content, SnapshotOptions options)
Parameters
contentstringThe content to normalize.
optionsSnapshotOptionsThe options to apply.
Returns
- string
The normalized content.
Exceptions
- ArgumentNullException
A required argument is null.