private static void AssertVisualStudioCanBeUsed(IVisualStudio visualStudio) { string version = null; visualStudio.Call(dte => version = dte.Version); Assert.IsNotNull(version); Assert.Throws <ArgumentNullException>(() => visualStudio.Call(null)); Assert.DoesNotThrow(() => visualStudio.BringToFront()); Assert.IsNotNull(visualStudio.GetDebugger(new DebuggerSetup())); Assert.Throws <ArgumentNullException>(() => visualStudio.GetDebugger(null)); }
private bool NavigateToFileInVisualStudio(string path, int lineNumber, int columnNumber) { path = Path.GetFullPath(path); var logger = NullLogger.Instance; IVisualStudio visualStudio = visualStudioManager.GetVisualStudio(VisualStudioVersion.Any, true, logger); if (visualStudio == null) { return(false); } visualStudio.Call(dte => { Window window = OpenFile(dte, path); if (window == null) { window = FindFileInSolution(dte, path); } TextSelection selection = window.Selection as TextSelection; if (lineNumber != 0) { if (selection != null) { selection.MoveToLineAndOffset(lineNumber, Math.Max(1, columnNumber), false); } } window.Activate(); window.Visible = true; }); visualStudio.BringToFront(); return(true); }
private static void AssertVisualStudioCanBeUsed(IVisualStudio visualStudio) { string version = null; visualStudio.Call(dte => version = dte.Version); Assert.IsNotNull(version); Assert.Throws<ArgumentNullException>(() => visualStudio.Call(null)); Assert.DoesNotThrow(() => visualStudio.BringToFront()); Assert.IsNotNull(visualStudio.GetDebugger(new DebuggerSetup())); Assert.Throws<ArgumentNullException>(() => visualStudio.GetDebugger(null)); }