Skip to content

ShouldContainHtml always passes due to typo in PrettyHtmlExtensions.cs #3337

@leemthompo

Description

@leemthompo

In PrettyHtmlExtensions.cs, expectedCompare is assigned from actual instead of expected:

var actualCompare = actual.Replace("\t", string.Empty);
var expectedCompare = actual.Replace("\t", string.Empty); // should be `expected`

This means the contains check on line 88 is actual.Contains(actual), which always passes. Any test using ShouldContainHtml silently passes regardless of output.

Many test assertions across the test suite use this helper.

Found while investigating #3324, where the MagicCallOutWithFormatting test passes despite the callout parser rejecting its input.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions