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); }
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); } }
protected Document CreateDocumentFromCode(string code, string projectName = null, string documentName = null) { return(MarkupHelper.GetDocumentFromCode(code, LanguageName, References, projectName, documentName)); }
protected void NoDiagnostic(string code, string diagnosticId) { var document = MarkupHelper.GetDocumentFromCode(code, LanguageName, References); NoDiagnostic(document, diagnosticId); }