Skip to content

Commit aeaead8

Browse files
committed
Migrate to file scoped namespace
1 parent ec8ec60 commit aeaead8

54 files changed

Lines changed: 2422 additions & 2476 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Roslyn.Testing/Analyzer/CSharpDiagnosticAnalyzerTest.cs

Lines changed: 57 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -5,72 +5,71 @@
55
using Roslyn.Testing.Model;
66
using Shouldly;
77

8-
namespace Roslyn.Testing.Analyzer
8+
namespace Roslyn.Testing.Analyzer;
9+
10+
public abstract class CSharpDiagnosticAnalyzerTest<T> : FileReaderTest
11+
where T : DiagnosticAnalyzer, new()
912
{
10-
public abstract class CSharpDiagnosticAnalyzerTest<T> : FileReaderTest
11-
where T : DiagnosticAnalyzer, new()
12-
{
13-
/// <inheritdoc />
14-
public override string Filepath => _diagnosticAnalyzer.GetType().Name;
13+
/// <inheritdoc />
14+
public override string Filepath => _diagnosticAnalyzer.GetType().Name;
1515

16-
/// <inheritdoc />
17-
public override string PathToTestData => "./TestData/Analyzer/";
16+
/// <inheritdoc />
17+
public override string PathToTestData => "./TestData/Analyzer/";
1818

19-
private readonly DiagnosticAnalyzer _diagnosticAnalyzer;
19+
private readonly DiagnosticAnalyzer _diagnosticAnalyzer;
2020

21-
protected CSharpDiagnosticAnalyzerTest()
22-
{
23-
_diagnosticAnalyzer = new T();
24-
}
21+
protected CSharpDiagnosticAnalyzerTest()
22+
{
23+
_diagnosticAnalyzer = new T();
24+
}
2525

26-
protected virtual IEnumerable<MetadataReference> GetAdditionalReferences()
27-
{
28-
return Enumerable.Empty<MetadataReference>();
29-
}
26+
protected virtual IEnumerable<MetadataReference> GetAdditionalReferences()
27+
{
28+
return Enumerable.Empty<MetadataReference>();
29+
}
3030

31-
/// <summary>
32-
/// Called to test a C# DiagnosticAnalyzer when applied on the single inputted
33-
/// string as a source
34-
/// Note: input a DiagnosticResult for each Diagnostic expected
35-
/// </summary>
36-
/// <param name="source"> A class in the form of a string to run the analyzer on </param>
37-
/// <param name="expected">
38-
/// DiagnosticResults that should appear after the analyzer
39-
/// is run on the source
40-
/// </param>
41-
protected void VerifyDiagnostic(string source, DiagnosticResult[] expected)
42-
{
43-
VerifyDiagnostic(new[] { source }, expected);
44-
}
31+
/// <summary>
32+
/// Called to test a C# DiagnosticAnalyzer when applied on the single inputted
33+
/// string as a source
34+
/// Note: input a DiagnosticResult for each Diagnostic expected
35+
/// </summary>
36+
/// <param name="source"> A class in the form of a string to run the analyzer on </param>
37+
/// <param name="expected">
38+
/// DiagnosticResults that should appear after the analyzer
39+
/// is run on the source
40+
/// </param>
41+
protected void VerifyDiagnostic(string source, DiagnosticResult[] expected)
42+
{
43+
VerifyDiagnostic(new[] { source }, expected);
44+
}
4545

46-
protected void VerifyDiagnostic(string source, DiagnosticResult expected)
47-
{
48-
VerifyDiagnostic(new[] { source }, new[] { expected });
49-
}
46+
protected void VerifyDiagnostic(string source, DiagnosticResult expected)
47+
{
48+
VerifyDiagnostic(new[] { source }, new[] { expected });
49+
}
5050

51-
protected void VerifyNoDiagnosticTriggered(string source)
52-
{
53-
VerifyDiagnostic(new[] { source }, new DiagnosticResult[0]);
54-
}
51+
protected void VerifyNoDiagnosticTriggered(string source)
52+
{
53+
VerifyDiagnostic(new[] { source }, new DiagnosticResult[0]);
54+
}
5555

56-
/// <summary>
57-
/// Called to test a C# DiagnosticAnalyzer when applied on the inputted strings as
58-
/// a source
59-
/// Note: input a DiagnosticResult for each Diagnostic expected
60-
/// </summary>
61-
/// <param name="sources">
62-
/// An array of strings to create source documents from to
63-
/// run the analyzers on
64-
/// </param>
65-
/// <param name="expected">
66-
/// DiagnosticResults that should appear after the analyzer
67-
/// is run on the sources
68-
/// </param>
69-
protected void VerifyDiagnostic(string[] sources, DiagnosticResult[] expected)
70-
{
71-
var actual = _diagnosticAnalyzer.GetSortedDiagnostics(sources, LanguageNames.CSharp, GetAdditionalReferences());
72-
var result = _diagnosticAnalyzer.VerifyDiagnosticResults(actual, expected);
73-
result.Success.ShouldBe(true, result.ErrorMessage);
74-
}
56+
/// <summary>
57+
/// Called to test a C# DiagnosticAnalyzer when applied on the inputted strings as
58+
/// a source
59+
/// Note: input a DiagnosticResult for each Diagnostic expected
60+
/// </summary>
61+
/// <param name="sources">
62+
/// An array of strings to create source documents from to
63+
/// run the analyzers on
64+
/// </param>
65+
/// <param name="expected">
66+
/// DiagnosticResults that should appear after the analyzer
67+
/// is run on the sources
68+
/// </param>
69+
protected void VerifyDiagnostic(string[] sources, DiagnosticResult[] expected)
70+
{
71+
var actual = _diagnosticAnalyzer.GetSortedDiagnostics(sources, LanguageNames.CSharp, GetAdditionalReferences());
72+
var result = _diagnosticAnalyzer.VerifyDiagnosticResults(actual, expected);
73+
result.Success.ShouldBe(true, result.ErrorMessage);
7574
}
7675
}

0 commit comments

Comments
 (0)