Skip to content

Conversation

Evangelink
Copy link
Member

Fixes #6690

public static partial class AssertExtensions
{
// Constants for standardized display values
private const string FailedToEvaluate = "<Failed to evaluate>";
Copy link
Member

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?

Copy link
Member Author

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.

}

// Fallback - this should not happen if EvaluateAllSubExpressions works correctly
return false;
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test passes but imho should not, we get no information about the second call to box.GetNumber, leaving us stumped why it failed. Especially if we use expected = 1, not super easy to debug :)

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Assert.That evaluates expression twice

3 participants