public static void VerifyNoIssueReportedInTest(string path, SonarDiagnosticAnalyzer diagnosticAnalyzer) { VerifyNoIssueReported(path, TestAssemblyName, diagnosticAnalyzer); }
public static void VerifyAnalyzer(string path, SonarDiagnosticAnalyzer diagnosticAnalyzer, ParseOptions options = null, params AssemblyReference[] additionalReferences) { VerifyAnalyzer(new[] { path }, diagnosticAnalyzer, null, options, additionalReferences); }
public static void VerifyAnalyzer(string path, SonarDiagnosticAnalyzer diagnosticAnalyzer, IEnumerable <ParseOptions> options = null, CompilationErrorBehavior checkMode = CompilationErrorBehavior.Default, IEnumerable <MetadataReference> additionalReferences = null) { VerifyAnalyzer(new[] { path }, diagnosticAnalyzer, options, checkMode, additionalReferences); }
public static void VerifyNoIssueReported(string path, SonarDiagnosticAnalyzer diagnosticAnalyzer, ParseOptions options = null, params AssemblyReference[] additionalReferences) { VerifyNoIssueReported(path, GeneratedAssemblyName, diagnosticAnalyzer, additionalReferences, options); }
public static void VerifyVisualBasicAnalyzer(string snippet, SonarDiagnosticAnalyzer diagnosticAnalyzer, ParseOptions options = null, params AssemblyReference[] additionalReferences) { VerifyAnalyzer(new[] { new DocumentInfo($"file1{VisualBasicFileExtension}", snippet) }, VisualBasicFileExtension, diagnosticAnalyzer, options, null, additionalReferences); }
public static void VerifyCodeFix(string path, string pathToExpected, string pathToBatchExpected, SonarDiagnosticAnalyzer diagnosticAnalyzer, SonarCodeFixProvider codeFixProvider, string codeFixTitle) { using (var workspace = new AdhocWorkspace()) { var file = new FileInfo(path); var parseOptions = GetParseOptionsWithDifferentLanguageVersions(null, file.Extension); foreach (var parseOption in parseOptions) { var document = GetDocument(file, GeneratedAssemblyName, workspace, removeAnalysisComments: true); RunCodeFixWhileDocumentChanges(diagnosticAnalyzer, codeFixProvider, codeFixTitle, document, parseOption, pathToExpected); } } VerifyFixAllCodeFix(path, pathToBatchExpected, diagnosticAnalyzer, codeFixProvider, codeFixTitle); }
public static void VerifyNoIssueReportedInTest(string path, SonarDiagnosticAnalyzer diagnosticAnalyzer, params AssemblyReference[] additionalReferences) { VerifyNoIssueReported(path, TestAssemblyName, diagnosticAnalyzer, additionalReferences); }
public static void VerifyCodeFix(string path, string pathToExpected, string pathToBatchExpected, SonarDiagnosticAnalyzer diagnosticAnalyzer, SonarCodeFixProvider codeFixProvider) { VerifyCodeFix(path, pathToExpected, pathToBatchExpected, diagnosticAnalyzer, codeFixProvider, null); }
public static void VerifyCodeFix(string path, string pathToExpected, SonarDiagnosticAnalyzer diagnosticAnalyzer, SonarCodeFixProvider codeFixProvider, string codeFixTitle) { VerifyCodeFix(path, pathToExpected, pathToExpected, diagnosticAnalyzer, codeFixProvider, codeFixTitle); }
/// <summary> /// Verify analyzer from C# 9 with top level statements. /// </summary> public static void VerifyAnalyzerFromCSharp9Console(string path, SonarDiagnosticAnalyzer diagnosticAnalyzer, IEnumerable <MetadataReference> additionalReferences = null) => VerifyAnalyzer(new[] { path }, diagnosticAnalyzer, ParseOptionsHelper.FromCSharp9, CompilationErrorBehavior.Default, OutputKind.ConsoleApplication, additionalReferences);
// This method is checking only the expected issues from the first file path provided. The rest of the paths are added to the // project for enabling testing of different scenarios. public static void VerifyAnalyzer(IEnumerable <string> paths, SonarDiagnosticAnalyzer diagnosticAnalyzer, IEnumerable <ParseOptions> options = null, CompilationErrorBehavior checkMode = CompilationErrorBehavior.Default, OutputKind outputKind = OutputKind.DynamicallyLinkedLibrary, IEnumerable <MetadataReference> additionalReferences = null) => VerifyAnalyzer(paths, new[] { diagnosticAnalyzer }, options, checkMode, outputKind, additionalReferences);
public static void VerifyCodeFix(string path, string pathToExpected, SonarDiagnosticAnalyzer diagnosticAnalyzer, SonarCodeFixProvider codeFixProvider, string codeFixTitle, IEnumerable <ParseOptions> options = null, IEnumerable <MetadataReference> additionalReferences = null) { CodeFixVerifier.VerifyCodeFix(path, pathToExpected, pathToExpected, diagnosticAnalyzer, codeFixProvider, codeFixTitle, options, additionalReferences); }
public TestSetup(string testCase, SonarDiagnosticAnalyzer analyzer, IEnumerable <MetadataReference> additionalReferences) { Path = System.IO.Path.Combine("TestCases", testCase); Analyzer = analyzer; AdditionalReferences = additionalReferences.Concat(MetadataReferenceFacade.SystemComponentModelPrimitives).Concat(NetStandardMetadataReference.Netstandard); }
public TestSetup(string testCase, SonarDiagnosticAnalyzer analyzer) : this(testCase, analyzer, Enumerable.Empty <MetadataReference>()) { }