C# 클래스 TestHelper.DiagnosticVerifier

Superclass of all Unit Tests for DiagnosticAnalyzers
파일 보기 프로젝트 열기: signumsoftware/framework 1 사용 예제들

보호된 메소드들

메소드 설명
CreateDocument ( string source ) : Microsoft.CodeAnalysis.Document

Create a Document from a string through creating a project that contains it.

GetCSharpDiagnosticAnalyzer ( ) : Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer
GetSortedDiagnosticsFromDocuments ( Microsoft.CodeAnalysis.Document documents ) : Diagnostic[]
VerifyDiagnostic ( string source ) : void

Called to test a C# DiagnosticAnalyzer when applied on the single inputted string as a source Note: input a DiagnosticResult for each Diagnostic expected

비공개 메소드들

메소드 설명
CreateProject ( string sources ) : Microsoft.CodeAnalysis.Project

Create a project using the inputted strings as sources.

FormatDiagnostics ( Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer analyzer ) : string

Helper method to format a Diagnostic into an easily readable string

GetDocuments ( string sources ) : Microsoft.CodeAnalysis.Document[]

Given an array of strings as sources and a language, turn them into a project and return the documents and spans of it.

VerifyDiagnosticResults ( IEnumerable actualResults ) : void

Checks each of the actual Diagnostics found and compares them with the corresponding DiagnosticResult in the array of expected results. Diagnostics are considered equal only if the DiagnosticResultLocation, Id, Severity, and Message of the DiagnosticResult match the actual diagnostic.

메소드 상세

CreateDocument() 보호된 정적인 메소드

Create a Document from a string through creating a project that contains it.
protected static CreateDocument ( string source ) : Microsoft.CodeAnalysis.Document
source string Classes in the form of a string
리턴 Microsoft.CodeAnalysis.Document

GetCSharpDiagnosticAnalyzer() 보호된 메소드

protected GetCSharpDiagnosticAnalyzer ( ) : Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer
리턴 Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer

GetSortedDiagnosticsFromDocuments() 보호된 메소드

protected GetSortedDiagnosticsFromDocuments ( Microsoft.CodeAnalysis.Document documents ) : Diagnostic[]
documents Microsoft.CodeAnalysis.Document
리턴 Diagnostic[]

VerifyDiagnostic() 보호된 메소드

Called to test a C# DiagnosticAnalyzer when applied on the single inputted string as a source Note: input a DiagnosticResult for each Diagnostic expected
protected VerifyDiagnostic ( string source ) : void
source string A class in the form of a string to run the analyzer on
리턴 void