protected void TestCodeRefactoringAtLine(string code, string expected, int line, int refactoringIndex = 0)
        {
            var document = MarkupHelper.GetDocumentFromCode(code, LanguageName, References);
            var locator  = LineLocator.FromCode(code, line);

            TestCodeRefactoring(document, expected, locator, refactoringIndex);
        }
예제 #2
0
        protected void HasDiagnosticAtLine(string code, string diagnosticId, int lineNumber)
        {
            var document = MarkupHelper.GetDocumentFromCode(code, LanguageName, References);
            var locator  = LineLocator.FromCode(code, lineNumber);

            HasDiagnostic(document, diagnosticId, locator);
        }
        protected void NoException(string code)
        {
            var document    = MarkupHelper.GetDocumentFromCode(code, LanguageName, References);
            var diagnostics = GetDiagnostics(document);
            var diagnostic  = diagnostics.FirstOrDefault(d => d.Id == "AD0001");

            if (diagnostic != null)
            {
                throw RoslynTestKitException.ExceptionInAnalyzer(diagnostic);
            }
        }
예제 #4
0
 protected Document CreateDocumentFromCode(string code, string projectName = null, string documentName = null)
 {
     return(MarkupHelper.GetDocumentFromCode(code, LanguageName, References, projectName, documentName));
 }
예제 #5
0
        protected void NoDiagnostic(string code, string diagnosticId)
        {
            var document = MarkupHelper.GetDocumentFromCode(code, LanguageName, References);

            NoDiagnostic(document, diagnosticId);
        }