protected void HasDiagnostic(string markupCode, string diagnosticId)
        {
            var markup   = new CodeMarkup(markupCode);
            var document = CreateDocumentFromCode(markup.Code);

            HasDiagnostic(document, diagnosticId, markup.Locator);
        }
        protected void TestNoCodeRefactoring(string markupCode)
        {
            var markup   = new CodeMarkup(markupCode);
            var document = CreateDocumentFromCode(markup.Code);

            TestNoCodeRefactoring(document, markup.Locator);
        }
        protected void NoDiagnosticAtMarker(string markup, string diagnosticId)
        {
            var codeMarkup = new CodeMarkup(markup);
            var document   = CreateDocumentFromCode(codeMarkup.Code);

            NoDiagnostic(document, diagnosticId, codeMarkup.Locator);
        }
        protected void TestCodeRefactoring(string markupCode, string expected, int refactoringIndex = 0)
        {
            var markup   = new CodeMarkup(markupCode);
            var document = CreateDocumentFromCode(markup.Code);

            TestCodeRefactoring(document, expected, markup.Locator, new ByIndexCodeActionSelector(refactoringIndex));
        }
        protected void TestCodeRefactoring(string markupCode, string expected, string title)
        {
            var markup   = new CodeMarkup(markupCode);
            var document = CreateDocumentFromCode(markup.Code);

            TestCodeRefactoring(document, expected, markup.Locator, new ByTitleCodeActionSelector(title));
        }
        protected void TestCompletion(string markupCode, Action <ImmutableArray <CompletionItem> > assertion, CompletionTrigger?trigger = null)
        {
            var markup   = new CodeMarkup(markupCode);
            var document = CreateDocumentFromCode(markup.Code);

            VerifyExpectations(document, markup.Locator, trigger, assertion);
        }
        protected void TestCodeFix(string markupCode, string expected, string diagnosticId, ICodeActionSelector actionSelector)
        {
            var markup   = new CodeMarkup(markupCode);
            var document = CreateDocumentFromCode(markup.Code);

            TestCodeFix(document, expected, diagnosticId, markup.Locator, actionSelector);
        }
        protected void TestCompletion(string markupCode, string[] expectedCompletions, CompletionTrigger?trigger = null)
        {
            var markup    = new CodeMarkup(markupCode);
            var document  = CreateDocumentFromCode(markup.Code);
            var assertion = CreateAssertionBasedOnExpectedSet(expectedCompletions, markup.Locator);

            VerifyExpectations(document, markup.Locator, trigger, assertion);
        }
        protected void NoCodeFix(string markupCode, DiagnosticDescriptor descriptor)
        {
            var markup     = new CodeMarkup(markupCode);
            var document   = CreateDocumentFromCode(markup.Code);
            var diagnostic = FindOrCreateDiagnosticForDescriptor(document, descriptor, markup.Locator);

            NoCodeFix(document, diagnostic, markup.Locator);
        }
        protected void TestCodeFix(string markupCode, string expected, DiagnosticDescriptor descriptor, int codeFixIndex = 0)
        {
            var markup     = new CodeMarkup(markupCode);
            var document   = CreateDocumentFromCode(markup.Code);
            var diagnostic = FindOrCreateDiagnosticForDescriptor(document, descriptor, markup.Locator);

            TestCodeFix(document, expected, diagnostic, markup.Locator, new ByIndexCodeActionSelector(codeFixIndex));
        }