Skip to content

Commit 225c30b

Browse files
Copilotbcollamore
andcommitted
Fix dogfooding build failures: Replace variable named '_' with proper discard and add missing TestCategory attributes to PH2147 tests
Co-authored-by: bcollamore <57269455+bcollamore@users.noreply.github.com>
1 parent 35e2554 commit 225c30b

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

Philips.CodeAnalysis.MsTestAnalyzers/TestHasTimeoutAnalyzer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ protected override void OnTestMethod(SyntaxNodeAnalysisContext context, MethodDe
100100
return;
101101
}
102102

103-
if (!TryExtractAttributeArgument(context, argumentSyntax, out var timeoutString, out int _))
103+
if (!TryExtractAttributeArgument<int>(context, argumentSyntax, out var timeoutString, out _))
104104
{
105105
return;
106106
}

Philips.CodeAnalysis.Test/Maintainability/Naming/AvoidVariableNamedUnderscoreAnalyzerTest.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using Microsoft.VisualStudio.TestTools.UnitTesting;
66
using Philips.CodeAnalysis.Common;
77
using Philips.CodeAnalysis.MaintainabilityAnalyzers.Naming;
8+
using Philips.CodeAnalysis.Test.Helpers;
89
using Philips.CodeAnalysis.Test.Verifiers;
910

1011
namespace Philips.CodeAnalysis.Test.Maintainability.Naming
@@ -18,6 +19,7 @@ protected override DiagnosticAnalyzer GetDiagnosticAnalyzer()
1819
}
1920

2021
[TestMethod]
22+
[TestCategory(TestDefinitions.UnitTests)]
2123
public async Task LocalVariableNamedUnderscoreShouldFlag()
2224
{
2325
var test = @"
@@ -35,6 +37,7 @@ public void TestMethod()
3537
}
3638

3739
[TestMethod]
40+
[TestCategory(TestDefinitions.UnitTests)]
3841
public async Task ForEachVariableNamedUnderscoreShouldFlag()
3942
{
4043
var test = @"
@@ -56,6 +59,7 @@ public void TestMethod()
5659
}
5760

5861
[TestMethod]
62+
[TestCategory(TestDefinitions.UnitTests)]
5963
public async Task OutParameterNamedUnderscoreShouldFlag()
6064
{
6165
var test = @"
@@ -78,6 +82,7 @@ private void TestHelper(out int value)
7882
}
7983

8084
[TestMethod]
85+
[TestCategory(TestDefinitions.UnitTests)]
8186
public async Task ForLoopVariableNamedUnderscoreShouldFlag()
8287
{
8388
var test = @"
@@ -97,6 +102,7 @@ public void TestMethod()
97102
}
98103

99104
[TestMethod]
105+
[TestCategory(TestDefinitions.UnitTests)]
100106
public async Task UsingStatementVariableNamedUnderscoreShouldFlag()
101107
{
102108
var test = @"
@@ -117,6 +123,7 @@ public void TestMethod()
117123
}
118124

119125
[TestMethod]
126+
[TestCategory(TestDefinitions.UnitTests)]
120127
public async Task ValidVariableNamesShouldNotFlag()
121128
{
122129
var test = @"
@@ -136,6 +143,7 @@ public void TestMethod()
136143
}
137144

138145
[TestMethod]
146+
[TestCategory(TestDefinitions.UnitTests)]
139147
public async Task VariableStartingWithUnderscoreShouldNotFlag()
140148
{
141149
var test = @"
@@ -155,6 +163,7 @@ public void TestMethod()
155163
}
156164

157165
[TestMethod]
166+
[TestCategory(TestDefinitions.UnitTests)]
158167
public async Task FieldVariableNamedUnderscoreShouldNotFlag()
159168
{
160169
var test = @"
@@ -169,6 +178,7 @@ class TestClass
169178
}
170179

171180
[TestMethod]
181+
[TestCategory(TestDefinitions.UnitTests)]
172182
public async Task InParameterNamedUnderscoreShouldNotFlag()
173183
{
174184
var test = @"

0 commit comments

Comments
 (0)