Arnolyzer.Tests.DiagnosticVerification.DiagnosticsGenerator.GetSortedDiagnostics C# (CSharp) Метод

GetSortedDiagnostics() публичный статический Метод

public static GetSortedDiagnostics ( string filePath, Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer analyzer, string settingsPath ) : IOrderedEnumerable
filePath string
analyzer Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer
settingsPath string
Результат IOrderedEnumerable
        public static IOrderedEnumerable<Diagnostic> GetSortedDiagnostics(string filePath,
                                                                          DiagnosticAnalyzer analyzer,
                                                                          string settingsPath)
        {
            var options = new AnalyzerOptions(ImmutableArray.Create<AdditionalText>(new SettingsFile(settingsPath)));
            return GetSortedDiagnosticsFromDocuments(analyzer,
                                                     DocumentSetCreator.CreateDocumentSetFromSources(filePath),
                                                     options);
        }

Usage Example

Пример #1
0
        public static void VerifyDiagnostics <T>(string filePath, params DiagnosticResult[] expected)
            where T : DiagnosticAnalyzer, new()
        {
            var analyzer    = new T();
            var diagnostics = DiagnosticsGenerator.GetSortedDiagnostics(filePath, analyzer, SettingsFile);

            VerifyDiagnosticResults(diagnostics, analyzer, expected);
        }