protected static void AssertExpectedDiagnostics(IEnumerable <ExpectedDiagnostic> expected, Ide.Gui.Document doc) { var ext = doc.GetContent <ResultsEditorExtension> (); var actualDiagnostics = ext.QuickTasks; var expectedDiagnostics = expected.ToArray(); Assert.AreEqual(expectedDiagnostics.Length, actualDiagnostics.Length); for (int i = 0; i < expectedDiagnostics.Length; ++i) { AssertExpectedDiagnostic(expectedDiagnostics [i], ext, i); } }
protected static async Task AssertExpectedCodeFixes(ExpectedCodeFixes expected, Ide.Gui.Document doc) { var fixes = await doc.GetContent <CodeActionEditorExtension> ().GetCurrentFixesAsync(CancellationToken.None); var fixActions = fixes.CodeFixActions.SelectMany(x => x.Fixes).OrderBy(f => f.Action.Message).ToArray(); Assert.AreEqual(expected.CodeFixData.Length, fixActions.Length); for (int j = 0; j < expected.CodeFixData.Length; ++j) { Assert.AreEqual(expected.CodeFixData [j].Message, fixActions [j].Action.Message); } var fixRefactorings = fixes.CodeRefactoringActions.SelectMany(x => x.Actions).OrderBy(f => f.Message).ToArray(); Assert.AreEqual(expected.CodeRefactoringData.Length, fixRefactorings.Length); for (int j = 0; j < expected.CodeRefactoringData.Length; ++j) { Assert.AreEqual(expected.CodeRefactoringData [j].Message, fixRefactorings [j].Message); } }
protected void RegisterExtensionCallback <T> (Ide.Gui.Document doc, Action <T> registerCallback) where T : TextEditorExtension { var ext = doc.GetContent <T> (); registerCallback(ext); }