-
Notifications
You must be signed in to change notification settings - Fork 285
Fix Assert.That to not evaluate expression twice #6699
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
public static partial class AssertExtensions | ||
{ | ||
// Constants for standardized display values | ||
private const string FailedToEvaluate = "<Failed to evaluate>"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want this to be localized?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine by me. FYI it wasn't localized before.
…soft/testfx into dev/amauryleve/assert-that
} | ||
|
||
// Fallback - this should not happen if EvaluateAllSubExpressions works correctly | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider throwing here if we should not reach it.
.WithMessage(""" | ||
Assert.That(() => box.GetNumber() + box.GetNumber() == 0) failed. | ||
Details: | ||
box.GetNumber() = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes #6690