Add Document-based test methods to AnalyzerTestFixture
This commit is contained in:
Родитель
e7f87caab9
Коммит
049cced418
|
@ -15,6 +15,12 @@ namespace RoslynNUnitLight
|
|||
protected void NoDiagnostic(string code, string diagnosticId)
|
||||
{
|
||||
var document = GetDocument(code);
|
||||
|
||||
NoDiagnostic(document, diagnosticId);
|
||||
}
|
||||
|
||||
protected void NoDiagnostic(Document document, string diagnosticId)
|
||||
{
|
||||
var diagnostics = GetDiagnostics(document);
|
||||
|
||||
Assert.That(diagnostics.Any(d => d.Id == diagnosticId), Is.False);
|
||||
|
@ -26,6 +32,11 @@ namespace RoslynNUnitLight
|
|||
TextSpan span;
|
||||
Assert.That(TryGetDocumentAndSpan(markupCode, out document, out span), Is.True);
|
||||
|
||||
HasDiagnostic(document, span, diagnosticId);
|
||||
}
|
||||
|
||||
protected void HasDiagnostic(Document document, TextSpan span, string diagnosticId)
|
||||
{
|
||||
var diagnostics = GetDiagnostics(document);
|
||||
Assert.That(diagnostics.Length, Is.EqualTo(1));
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче