SnapshotComparer Class

Provides methods for comparing and normalizing snapshot values.

public abstract class SnapshotComparer

Constructors

NameDescription
SnapshotComparer()

SnapshotComparer()

protected SnapshotComparer()

No documentation is available.

Properties

NameDescription
DefaultGets the default snapshot comparer that normalizes whitespace and compares line by line.
OrdinalGets a snapshot comparer that compares the values exactly, using an ordinal comparison, without normalizing line endings, tabs or whitespace-only lines.

Gets the default snapshot comparer that normalizes whitespace and compares line by line.

public static SnapshotComparer Default { get; }

Property value

SnapshotComparer

Gets a snapshot comparer that compares the values exactly, using an ordinal comparison, without normalizing line endings, tabs or whitespace-only lines.

public static SnapshotComparer Ordinal { get; }

Property value

SnapshotComparer

Methods

NameDescription
AreEqual(string?, string?)Determines whether two snapshot values are equal.
NormalizeValue(string?)Normalizes a snapshot value before comparison. The default implementation returns the value unchanged.

AreEqual(string?, string?)

Determines whether two snapshot values are equal.

public abstract bool AreEqual(string? actual, string? expected)

Parameters

actual string?
The actual snapshot value.
expected string?
The expected snapshot value.

Returns

bool true if the values are equal; otherwise, false.

NormalizeValue(string?)

SnapshotComparer.cs

Normalizes a snapshot value before comparison. The default implementation returns the value unchanged.

public virtual string? NormalizeValue(string? value)

Parameters

value string?
The value to normalize.

Returns

string? The normalized value.