Skip to content

Improve tests by adding ↓ to tests were it is missing in the sourceΒ #894

Closed

Description

@mikkelbu

During a review I noticed that in e.g. AnalyzeWhenTypedCustomComparerProvided we don't have a ↓.

public void AnalyzeWhenTypedCustomComparerProvided()
{
var testCode = TestUtility.WrapInTestMethod($@"
var actual = new[] {{ ""1"", ""2"", ""3"" }};
Assert.That(actual, {this.constraint}(1).Using((IEqualityComparer<string>)StringComparer.Ordinal));",
"using System.Collections.Generic;");
RoslynAssert.Diagnostics(analyzer,
expectedDiagnostic.WithMessage($"The '{this.constraint}' constraint cannot be used with actual argument of type 'string[]' and expected argument of type 'int'"),
testCode);
}

This is not a major problem - and I guess we only have a few tests like this, but to make the tests more precise we should check that all tests with RoslynAssert.Diagnostics, RoslynAssert.CodeFix or RoslynAssert.Suppressed contains a ↓ in the expected location.

EDIT: Full list of RoslynAssert... that we currently use

RoslynAssert.CodeFix
RoslynAssert.Diagnostics
RoslynAssert.FixAll
RoslynAssert.NoAnalyzerDiagnostics
RoslynAssert.NoFix
RoslynAssert.NotSuppressed
RoslynAssert.Suppressed
RoslynAssert.Valid

Activity

  1. self-assigned this
    on Jun 17, 2025
  2. added this to the Release 4.10 milestone on Jun 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions