Skip to content

Commit c977172

Browse files
committed
Made the Test project compatible with StyleCop.
1 parent 197e7bd commit c977172

10 files changed

+596
-347
lines changed

DotNet.SystemCollections.Analyzers.Test/Arrays/DoNotHaveFieldOfArrayTypeAnalyzerTest.cs

+35-17
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,38 @@
1-
using System;
2-
using DotNet.SystemCollections.Analyzers.Arrays;
3-
using DotNet.SystemCollections.Analyzers.Test.Verifiers;
4-
using Microsoft.CodeAnalysis;
5-
using Microsoft.CodeAnalysis.Diagnostics;
6-
using Microsoft.VisualStudio.TestTools.UnitTesting;
7-
8-
namespace DotNet.SystemCollections.Analyzers.Test.Arrays
1+
namespace DotNet.SystemCollections.Analyzers.Test.Arrays
92
{
3+
using System;
4+
using DotNet.SystemCollections.Analyzers.Arrays;
5+
using DotNet.SystemCollections.Analyzers.Test.Verifiers;
6+
using Microsoft.CodeAnalysis;
7+
using Microsoft.CodeAnalysis.Diagnostics;
8+
using Microsoft.VisualStudio.TestTools.UnitTesting;
9+
10+
/// <summary>
11+
/// This tester is used to test the <see cref="DoNotHaveFieldOfArrayTypeAnalyzer"/>.
12+
/// </summary>
1013
[TestClass]
1114
public class DoNotHaveFieldOfArrayTypeAnalyzerTest : DiagnosticVerifier
1215
{
13-
//No diagnostics expected to show up
16+
/// <summary>
17+
/// Test when given an empty input.
18+
/// </summary>
19+
/// <remarks>
20+
/// No diagnostics expected to show up.
21+
/// </remarks>
1422
[TestMethod]
1523
public void TestEmptyInput()
1624
{
17-
var test = @"";
25+
var test = string.Empty;
1826

1927
this.VerifyCSharpDiagnostic(test);
2028
}
2129

22-
//Diagnostic triggered and checked for
30+
/// <summary>
31+
/// Test when given a matching case.
32+
/// </summary>
33+
/// <remarks>
34+
/// Diagnostic triggered and checked for.
35+
/// </remarks>
2336
[TestMethod]
2437
public void TestMatchingCase()
2538
{
@@ -41,18 +54,23 @@ class TypeName
4154
var expected = new DiagnosticResult
4255
{
4356
Id = DoNotHaveFieldOfArrayTypeAnalyzer.DiagnosticId,
44-
Message = String.Format(DoNotHaveFieldOfArrayTypeAnalyzer.MessageFormat, "field"),
57+
Message = string.Format(DoNotHaveFieldOfArrayTypeAnalyzer.MessageFormat, "field"),
4558
Severity = DiagnosticSeverity.Warning,
46-
Locations =
47-
new[]
48-
{
49-
new DiagnosticResultLocation("Test0.cs", 13, 30)
50-
}
59+
Locations = new[]
60+
{
61+
new DiagnosticResultLocation("Test0.cs", 13, 30),
62+
},
5163
};
5264

5365
this.VerifyCSharpDiagnostic(test, expected);
5466
}
5567

68+
/// <summary>
69+
/// Gets the relevant C# diagnostic analyzer to test.
70+
/// </summary>
71+
/// <returns>
72+
/// This returns a new <see cref="DoNotHaveFieldOfArrayTypeAnalyzer"/>.
73+
/// </returns>
5674
protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer()
5775
{
5876
return new DoNotHaveFieldOfArrayTypeAnalyzer();

DotNet.SystemCollections.Analyzers.Test/Arrays/DoNotHaveMethodReturnArrayTypeAnalyzerTest.cs

+34-16
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,38 @@
1-
using System;
2-
using DotNet.SystemCollections.Analyzers.Arrays;
3-
using DotNet.SystemCollections.Analyzers.Test.Verifiers;
4-
using Microsoft.CodeAnalysis;
5-
using Microsoft.CodeAnalysis.Diagnostics;
6-
using Microsoft.VisualStudio.TestTools.UnitTesting;
7-
81
namespace DotNet.SystemCollections.Analyzers.Test.Arrays
92
{
3+
using System;
4+
using DotNet.SystemCollections.Analyzers.Arrays;
5+
using DotNet.SystemCollections.Analyzers.Test.Verifiers;
6+
using Microsoft.CodeAnalysis;
7+
using Microsoft.CodeAnalysis.Diagnostics;
8+
using Microsoft.VisualStudio.TestTools.UnitTesting;
9+
10+
/// <summary>
11+
/// This tester is used to test the <see cref="DoNotHaveMethodReturnArrayTypeAnalyzer"/>.
12+
/// </summary>
1013
[TestClass]
1114
public class DoNotHaveMethodReturnArrayTypeAnalyzerTest : DiagnosticVerifier
1215
{
13-
//No diagnostics expected to show up
16+
/// <summary>
17+
/// Test when given an empty input.
18+
/// </summary>
19+
/// <remarks>
20+
/// No diagnostics expected to show up.
21+
/// </remarks>
1422
[TestMethod]
1523
public void TestEmptyInput()
1624
{
17-
var test = @"";
25+
var test = string.Empty;
1826

1927
this.VerifyCSharpDiagnostic(test);
2028
}
2129

22-
//Diagnostic triggered and checked for
30+
/// <summary>
31+
/// Test when given a matching case.
32+
/// </summary>
33+
/// <remarks>
34+
/// Diagnostic triggered and checked for.
35+
/// </remarks>
2336
[TestMethod]
2437
public void TestMatchingCase()
2538
{
@@ -43,18 +56,23 @@ object[] MethodName()
4356
var expected = new DiagnosticResult
4457
{
4558
Id = DoNotHaveMethodReturnArrayTypeAnalyzer.DiagnosticId,
46-
Message = String.Format(DoNotHaveMethodReturnArrayTypeAnalyzer.MessageFormat, "MethodName"),
59+
Message = string.Format(DoNotHaveMethodReturnArrayTypeAnalyzer.MessageFormat, "MethodName"),
4760
Severity = DiagnosticSeverity.Warning,
48-
Locations =
49-
new[]
50-
{
51-
new DiagnosticResultLocation("Test0.cs", 13, 22)
52-
}
61+
Locations = new[]
62+
{
63+
new DiagnosticResultLocation("Test0.cs", 13, 22),
64+
},
5365
};
5466

5567
this.VerifyCSharpDiagnostic(test, expected);
5668
}
5769

70+
/// <summary>
71+
/// This is used to return the appropriate C# analyzer to test.
72+
/// </summary>
73+
/// <returns>
74+
/// Returns a new <see cref="DoNotHaveMethodReturnArrayTypeAnalyzer"/>.
75+
/// </returns>
5876
protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer()
5977
{
6078
return new DoNotHaveMethodReturnArrayTypeAnalyzer();

DotNet.SystemCollections.Analyzers.Test/Arrays/DoNotHavePropertyOfArrayTypeAnalyzerTest.cs

+34-16
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,38 @@
1-
using System;
2-
using DotNet.SystemCollections.Analyzers.Arrays;
3-
using DotNet.SystemCollections.Analyzers.Test.Verifiers;
4-
using Microsoft.CodeAnalysis;
5-
using Microsoft.CodeAnalysis.Diagnostics;
6-
using Microsoft.VisualStudio.TestTools.UnitTesting;
7-
81
namespace DotNet.SystemCollections.Analyzers.Test.Arrays
92
{
3+
using System;
4+
using DotNet.SystemCollections.Analyzers.Arrays;
5+
using DotNet.SystemCollections.Analyzers.Test.Verifiers;
6+
using Microsoft.CodeAnalysis;
7+
using Microsoft.CodeAnalysis.Diagnostics;
8+
using Microsoft.VisualStudio.TestTools.UnitTesting;
9+
10+
/// <summary>
11+
/// This tester is used to test the <see cref="DoNotHavePropertyOfArrayTypeAnalyzer"/>.
12+
/// </summary>
1013
[TestClass]
1114
public class DoNotHavePropertyOfArrayTypeAnalyzerTest : DiagnosticVerifier
1215
{
13-
//No diagnostics expected to show up
16+
/// <summary>
17+
/// Test when given empty input.
18+
/// </summary>
19+
/// <remarks>
20+
/// No diagnostics expected to show up.
21+
/// </remarks>
1422
[TestMethod]
1523
public void TestEmptyInput()
1624
{
17-
var test = @"";
25+
var test = string.Empty;
1826

1927
this.VerifyCSharpDiagnostic(test);
2028
}
2129

22-
//Diagnostic triggered and checked for
30+
/// <summary>
31+
/// Test when given a matching case,.
32+
/// </summary>
33+
/// <remarks>
34+
/// Diagnostic triggered and checked for.
35+
/// </remarks>
2336
[TestMethod]
2437
public void TestMatchingCase()
2538
{
@@ -41,18 +54,23 @@ class TypeName
4154
var expected = new DiagnosticResult
4255
{
4356
Id = DoNotHavePropertyOfArrayTypeAnalyzer.DiagnosticId,
44-
Message = String.Format(DoNotHavePropertyOfArrayTypeAnalyzer.MessageFormat, "Property"),
57+
Message = string.Format(DoNotHavePropertyOfArrayTypeAnalyzer.MessageFormat, "Property"),
4558
Severity = DiagnosticSeverity.Warning,
46-
Locations =
47-
new[]
48-
{
49-
new DiagnosticResultLocation("Test0.cs", 13, 30)
50-
}
59+
Locations = new[]
60+
{
61+
new DiagnosticResultLocation("Test0.cs", 13, 30),
62+
},
5163
};
5264

5365
this.VerifyCSharpDiagnostic(test, expected);
5466
}
5567

68+
/// <summary>
69+
/// This is used to get the relevant C# analyzer to test.
70+
/// </summary>
71+
/// <returns>
72+
/// Returns a new <see cref="DoNotHavePropertyOfArrayTypeAnalyzer"/>.
73+
/// </returns>
5674
protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer()
5775
{
5876
return new DoNotHavePropertyOfArrayTypeAnalyzer();

DotNet.SystemCollections.Analyzers.Test/DiagnosticResult.cs

-66
This file was deleted.

0 commit comments

Comments
 (0)