/// <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> /// <param name="sources"> /// An array of strings to create source documents from to run the analyzers on. /// </param> /// <param name="language"> /// The language of the classes represented by the source strings. /// </param> /// <param name="analyzer"> /// The analyzer to be run on the source code. /// </param> /// <param name="expected"> /// DiagnosticResults that should appear after the analyzer is run on the sources.</param> private void VerifyDiagnostics(string[] sources, string language, DiagnosticAnalyzer analyzer, params DiagnosticResult[] expected) { var diagnostics = DiagnosticVerifier.GetSortedDiagnostics(sources, language, analyzer); VerifyDiagnosticResults(diagnostics, analyzer, expected); }