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 = CreateDocumentFromCode(code); var locator = LineLocator.FromCode(code, lineNumber); HasDiagnostic(document, diagnosticId, locator); }
protected void TestCodeFixAtLine(string code, string expected, string diagnosticId, int line, int codeFixIndex = 0) { var document = MarkupHelper.GetDocumentFromMarkup(code, LanguageName, References); var locator = LineLocator.FromCode(code, line); TestCodeFix(document, expected, diagnosticId, locator, codeFixIndex); }
protected void TestCodeRefactoringAtLine(string code, string expected, int line, int refactoringIndex = 0) { var document = CreateDocumentFromCode(code); var locator = LineLocator.FromCode(code, line); TestCodeRefactoring(document, expected, locator, new ByIndexCodeActionSelector(refactoringIndex)); }
protected void NoCodeFixAtLine(string code, string diagnosticId, int line) { var document = MarkupHelper.GetDocumentFromMarkup(code, LanguageName, References); var locator = LineLocator.FromCode(code, line); NoCodeFix(document, diagnosticId, locator); }
private IEnumerable <Rectangle> FindVerticalEdges(Point startLocation) { // Use an area covering two hexes to maximise our chances of finding an edge var searchRect = new Rectangle(startLocation.X - HexGrid.HexWidth, startLocation.Y - HexGrid.HexHeight, HexGrid.HexWidth * 2, HexGrid.HexHeight * 2); sm_log.Info(Invariant($"Looking for vertical edge of hex in {searchRect}")); var edges = LineLocator.FindVerticalLines(Capture.Bitmap, searchRect, VerticalEdgeMinLength, col => col.IsWithinBrightnessThresholds(VerticalEdgeLowerThreshold, VerticalEdgeUpperThreshold)).ToList(); if (ScreenCapture.LoggingEnabled) { using (Graphics g = Graphics.FromImage(Capture.Bitmap)) { g.DrawRectangle(new Pen(Color.White, 1.0f), searchRect); var pen = new Pen(Color.Red, 1.0f); foreach (var edge in edges) { g.DrawRectangle(pen, edge); } } } if (!edges.Any()) { throw new AnalysisException("Can't find any vertical edges in the hex grid."); } return(edges); }
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 TestCodeFixAtLine(string code, string expected, string diagnosticId, int line, int codeFixIndex = 0) { var document = CreateDocumentFromCode(code); var locator = LineLocator.FromCode(code, line); TestCodeFix(document, expected, diagnosticId, locator, new ByIndexCodeActionSelector(codeFixIndex)); }
protected void NoCodeFixAtLine(string code, string diagnosticId, int line) { var document = CreateDocumentFromCode(code); var locator = LineLocator.FromCode(code, line); NoCodeFix(document, diagnosticId, locator); }
protected void TestCodeFixAtLine(string code, string expected, DiagnosticDescriptor descriptor, int line, int codeFixIndex = 0) { var document = MarkupHelper.GetDocumentFromMarkup(code, LanguageName, References); var locator = LineLocator.FromCode(code, line); var diagnostic = FindOrCreateDiagnosticForDescriptor(document, descriptor, locator); TestCodeFix(document, expected, diagnostic, locator, codeFixIndex); }
protected void TestCodeFixAtLine(string code, string expected, DiagnosticDescriptor descriptor, int line, int codeFixIndex = 0) { var document = CreateDocumentFromCode(code); var locator = LineLocator.FromCode(code, line); var diagnostic = FindOrCreateDiagnosticForDescriptor(document, descriptor, locator); TestCodeFix(document, expected, diagnostic, locator, new ByIndexCodeActionSelector(codeFixIndex)); }
protected void NoCodeFixAtLine(string code, DiagnosticDescriptor descriptor, int line) { var document = CreateDocumentFromCode(code); var locator = LineLocator.FromCode(code, line); var diagnostic = FindOrCreateDiagnosticForDescriptor(document, descriptor, locator); NoCodeFix(document, diagnostic, locator); }
public static int?FindPaletteHeader(Bitmap bitmap, int startY) { int y = startY; while (y < bitmap.Height) { int?lineY = LineLocator.FindHorizontalLineWithColor(bitmap, y, sm_paletteHeaderColor1, sm_lineComparer); if (!lineY.HasValue || lineY + 1 >= bitmap.Height) { break; } if (LineLocator.IsHorizontalLineWithColor(bitmap, lineY.Value + 1, sm_paletteHeaderColor2, sm_lineComparer)) { return(lineY); } y = lineY.Value + 1; } return(null); }
protected void TestCodeRefactoringAtLine(Document document, string expected, int line, int refactoringIndex = 0) { var locator = LineLocator.FromDocument(document, line); TestCodeRefactoring(document, expected, locator, refactoringIndex); }
protected void HasDiagnosticAtLine(Document document, string diagnosticId, int lineNumber) { var locator = LineLocator.FromDocument(document, lineNumber); HasDiagnostic(document, diagnosticId, locator); }