-
Notifications
You must be signed in to change notification settings - Fork 756
Closed
Description
In some situations a string comparison without taking whitespace into account is desirable.
A use-case would be JSON string comparison, which should be whitespace agnostic but requires perfect whitespace matching when using the EqualConstraint.
Current solution to the issue
To avoid this issue I have to write
Assert.That(resultingJsonString.WithoutWhitespace(), Is.EqualTo(expectedJsonString.WithoutWhitespace()));where WithoutWhitespace() is an extension method removing all whitespace characters.
Prefered syntax
It would be more fluent to write
Assert.That(resultingJsonString, Is.EqualTo(expectedJsonString).IgnoreWhitespace));IgnoreWhitespace was inspired by the existing IgnoreCase configuration.
zlepper