Add TestMissingCodeRefactoring method

We want tests to verify that specific refactroing is not available in some
test cases.
This commit is contained in:
Svetlozar Angelov 2015-11-13 17:11:31 +02:00
Родитель c5cc5f8841
Коммит 615fa1f46c
1 изменённых файлов: 16 добавлений и 0 удалений

Просмотреть файл

@ -22,6 +22,15 @@ namespace RoslynNUnitLight
TestCodeRefactoring(document, span, expected);
}
protected void TestMissingCodeRefactoring(string markupCode)
{
Document document;
TextSpan span;
Assert.That(TestHelpers.TryGetDocumentAndSpanFromMarkup(markupCode, LanguageName, out document, out span), Is.True);
TestMissingCodeRefactoring(document, span);
}
protected void TestCodeRefactoring(Document document, TextSpan span, string expected)
{
var codeRefactorings = GetCodeRefactorings(document, span);
@ -31,6 +40,13 @@ namespace RoslynNUnitLight
Verify.CodeAction(codeRefactorings[0], document, expected);
}
protected void TestMissingCodeRefactoring(Document document, TextSpan span)
{
var codeRefactorings = GetCodeRefactorings(document, span);
Assert.That(codeRefactorings.Length, Is.EqualTo(0));
}
private ImmutableArray<CodeAction> GetCodeRefactorings(Document document, TextSpan span)
{
var builder = ImmutableArray.CreateBuilder<CodeAction>();