Skip to content

Assert.AreEqual string: consider displaying the full actual and expected in addition to the diff #6717

@Evangelink

Description

@Evangelink

Summary

Let's take the following error diff:

Assert.AreEqual failed. Expected string length 199 but was 139. 'expected' expression: 'Normalize(expected)', 'actual' expression: 'Normalize(actual)'.
Expected: "...n 1; }␊    #endregion␊␊    #region ..."
But was:  "...n 1; }␊    #endregion␊    #endregion␊}"

This is nice for spotting the exact difference but it's sometimes interesting to have access to the full context.

For examples:

  1. When you are in a scenario where you are changing the output, it's useful to be able to copy the new expected content to replace current expected.

  2. When there are more than one issue, you would need to run the assert multiple times when having the full actual/expected might allow you to do an extra check upfront.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions