Skip to content

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

@mikkelbu

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

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