summaryrefslogtreecommitdiff
path: root/src/SMAPI.ModBuildConfig.Analyzer.Tests/Framework/DiagnosticVerifier.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI.ModBuildConfig.Analyzer.Tests/Framework/DiagnosticVerifier.cs')
-rw-r--r--src/SMAPI.ModBuildConfig.Analyzer.Tests/Framework/DiagnosticVerifier.cs31
1 files changed, 4 insertions, 27 deletions
diff --git a/src/SMAPI.ModBuildConfig.Analyzer.Tests/Framework/DiagnosticVerifier.cs b/src/SMAPI.ModBuildConfig.Analyzer.Tests/Framework/DiagnosticVerifier.cs
index 4170042d..efe69e4a 100644
--- a/src/SMAPI.ModBuildConfig.Analyzer.Tests/Framework/DiagnosticVerifier.cs
+++ b/src/SMAPI.ModBuildConfig.Analyzer.Tests/Framework/DiagnosticVerifier.cs
@@ -1,6 +1,6 @@
-#nullable disable
-
// <generated />
+// ReSharper disable All -- generated code
+
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -19,18 +19,7 @@ namespace SMAPI.ModBuildConfig.Analyzer.Tests.Framework
/// <summary>
/// Get the CSharp analyzer being tested - to be implemented in non-abstract class
/// </summary>
- protected virtual DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer()
- {
- return null;
- }
-
- /// <summary>
- /// Get the Visual Basic analyzer being tested (C#) - to be implemented in non-abstract class
- /// </summary>
- protected virtual DiagnosticAnalyzer GetBasicDiagnosticAnalyzer()
- {
- return null;
- }
+ protected abstract DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer();
#endregion
#region Verifier wrappers
@@ -47,17 +36,6 @@ namespace SMAPI.ModBuildConfig.Analyzer.Tests.Framework
}
/// <summary>
- /// Called to test a C# DiagnosticAnalyzer when applied on the inputted strings as a source
- /// Note: input a DiagnosticResult for each Diagnostic expected
- /// </summary>
- /// <param name="sources">An array of strings to create source documents from to run the analyzers on</param>
- /// <param name="expected">DiagnosticResults that should appear after the analyzer is run on the sources</param>
- protected void VerifyCSharpDiagnostic(string[] sources, params DiagnosticResult[] expected)
- {
- this.VerifyDiagnostics(sources, LanguageNames.CSharp, this.GetCSharpDiagnosticAnalyzer(), expected);
- }
-
- /// <summary>
/// General method that gets a collection of actual diagnostics found in the source after the analyzer is run,
/// then verifies each of them.
/// </summary>
@@ -222,11 +200,10 @@ namespace SMAPI.ModBuildConfig.Analyzer.Tests.Framework
Assert.IsTrue(location.IsInSource,
$"Test base does not currently handle diagnostics in metadata locations. Diagnostic in metadata: {diagnostics[i]}\r\n");
- string resultMethodName = diagnostics[i].Location.SourceTree.FilePath.EndsWith(".cs") ? "GetCSharpResultAt" : "GetBasicResultAt";
var linePosition = diagnostics[i].Location.GetLineSpan().StartLinePosition;
builder.AppendFormat("{0}({1}, {2}, {3}.{4})",
- resultMethodName,
+ "GetCSharpResultAt",
linePosition.Line + 1,
linePosition.Character + 1,
analyzerType.Name,