/// <summary> /// Given classes in the form of strings, their language, and an IDiagnosticAnalyzer to apply to it, return the diagnostics found in the string after converting it to a document. /// </summary> /// <param name="sources">Classes in the form of strings</param> /// <param name="language">The language the source classes are in</param> /// <param name="analyzer">The analyzer to be run on the sources</param> /// <returns>An IEnumerable of Diagnostics that surfaced in the source code, sorted by Location</returns> private static Diagnostic[] GetSortedDiagnostics(DiagnosticVerifier verifier, string[] sources, string language, DiagnosticAnalyzer analyzer) { return(GetSortedDiagnosticsFromDocuments(analyzer, GetDocuments(verifier, sources, language))); }
/// <summary> /// Create a Document from a string through creating a project that contains it. /// </summary> /// <param name="source">Classes in the form of a string</param> /// <param name="language">The language the source code is in</param> /// <returns>A Document created from the source string</returns> protected static Document CreateDocument(DiagnosticVerifier verifier, string source, string language = LanguageNames.CSharp) { return(CreateProject(verifier, new[] { source }, language).Documents.First()); }