dotnet / dotnet/sdk

Many Microsoft.CodeAnalysis.NetAnalyzers.UnitTests tests have duplicate test cases

Open
#52,993 0 comments 0 reactions 0 assignees View on GitHub
Area-Microsoft.CodeAnalysis.NetAnalyzers Test Debt untriaged
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

Reported by VS/VS Code when sdk.slnx is loaded.

```
[xUnit.net 00:00:06.08] Microsoft.CodeAnalysis.NetAnalyzers.UnitTests: Skipping test case with duplicate ID 'e41eef38623621b95010648d8e62ecb98b8de55e' ('Microsoft.NetCore.Analyzers.Performance.UnitTests.RecommendCaseInsensitiveStringComparison_CSharp_Tests.Diagnostic_Assign(diagnosedLine: "a.ToLower().IndexOf(value: b, count: 1, startIndex"···, fixedLine: "a.IndexOf(value: b, count: 1, startIndex: 1, compa"···)' and 'Microsoft.NetCore.Analyzers.Performance.UnitTests.RecommendCaseInsensitiveStringComparison_CSharp_Tests.Diagnostic_Assign(diagnosedLine: "a.ToLower().IndexOf(value: b, count: 1, startIndex"···, fixedLine: "a.IndexOf(value: b, count: 1, startIndex: 1, compa"···)')
[xUnit.net 00:00:06.08] Microsoft.CodeAnalysis.NetAnalyzers.UnitTests: Skipping test case with duplicate ID '3de5581da7327135cce75166c471d1449d85ad71' ('Microsoft.NetCore.Analyzers.Performance.UnitTests.RecommendCaseInsensitiveStringComparison_CSharp_Tests.Diagnostic_Assign(diagnosedLine: "a.ToUpper().IndexOf(value: b, count: 1, startIndex"···, fixedLine: "a.IndexOf(value: b, count: 1, startIndex: 1, compa"···)' and 'Microsoft.NetCore.Analyzers.Performance.UnitTests.RecommendCaseInsensitiveStringComparison_CSharp_Tests.Diagnostic_Assign(diagnosedLine: "a.ToUpper().IndexOf(value: b, count: 1, startIndex"···, fixedLine: "a.IndexOf(value: b, count: 1, startIndex: 1, compa"···)')
[xUnit.net 00:00:06.08] Microsoft.CodeAnalysis.NetAnalyzers.UnitTests: Skipping test case with duplicate ID 'd3129cb2f6a6a70f022f6d1484429b5cca6ccfbb' ('Microsoft.NetCore.Analyzers.Performance.UnitTests.RecommendCaseInsensitiveStringComparison_CSharp_Tests.Diagnostic_Assign(diagnosedLine: "a.ToLowerInvariant().IndexOf(value: b, count: 1, s"···, fixedLine: "a.IndexOf(value: b, count: 1, startIndex: 1, compa"···)' and 'Microsoft.NetCore.Analyzers.Performance.UnitTests.RecommendCaseInsensitiveStringComparison_CSharp_Tests.D

...
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Load sdk.slnx and locate the Microsoft.CodeAnalysis.NetAnalyzers.UnitTests tests, especially RecommendCaseInsensitiveStringComparison_CSharp_Tests.Diagnostic_Assign. Inspect the parameterized cases behind the duplicate IDs, then run the affected unit tests and confirm that no duplicate-test-case warnings remain.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.