Skip to content

Comments

Improve Assert.AreSame message for nulls#7426

Draft
Evangelink wants to merge 1 commit intomainfrom
dev/amauryleve/draft-assert-aresame
Draft

Improve Assert.AreSame message for nulls#7426
Evangelink wants to merge 1 commit intomainfrom
dev/amauryleve/draft-assert-aresame

Conversation

@Evangelink
Copy link
Member

Fix #7421

{
object? expected = null;
Action action = () => Assert.AreSame(expected, new object());
action.Should().Throw<Exception>().WithMessage("Assert.AreSame failed. Expected is <null>. 'expected' expression: 'expected', 'actual' expression: 'new object()'.");
Copy link
Member Author

Choose a reason for hiding this comment

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

We could also consider mixing the null part with the expressions, like:

Assert.AreSame failed. 'expected' expression: 'expected' is <null>, 'actual' expression: 'new object()'."

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.

Improve AreSame error messages in case of null values

1 participant