Description
Error messages across the assertion library use inconsistent prefixes, creating a fragmented user experience:
StringAssertions.cs:101 → "found \"{value}\""
NullAssertion.cs:51 → "value is null"
CollectionAssertions.cs:35 → "collection was null"
CollectionAssertions.cs:107 → "value was null"
GreaterThanAssertion.cs → "value is null" vs "found {value}"
BetweenAssertion.cs:81 → "value is null" vs line 95 "found {value}"
Impact
Inconsistent error messages reduce clarity and create cognitive friction. Users expect similar assertions to provide similarly-formatted feedback.
Suggested Fix
Establish a standard error message format:
- "found X" for actual values
- "was null" for null values
- "threw ExceptionName" for exceptions
Consider creating a helper method like CreateErrorMessage(string actual) to centralize formatting.
Description
Error messages across the assertion library use inconsistent prefixes, creating a fragmented user experience:
StringAssertions.cs:101→"found \"{value}\""NullAssertion.cs:51→"value is null"CollectionAssertions.cs:35→"collection was null"CollectionAssertions.cs:107→"value was null"GreaterThanAssertion.cs→"value is null"vs"found {value}"BetweenAssertion.cs:81→"value is null"vs line 95"found {value}"Impact
Inconsistent error messages reduce clarity and create cognitive friction. Users expect similar assertions to provide similarly-formatted feedback.
Suggested Fix
Establish a standard error message format:
Consider creating a helper method like
CreateErrorMessage(string actual)to centralize formatting.