public void SetUp() { logSpy = new LogSpy(); logSpy.Attach(); taskContext = new JoinableTaskContext(); returnObjectMock = Substitute.For <SbCommandReturnObject>(); returnObjectMock.GetDescription().Returns(COMMAND_DESCRIPTION); commandInterpreterMock = Substitute.For <SbCommandInterpreter>(); commandInterpreterMock.WhenForAnyArgs(x => x.HandleCommand(DUMMY_COMMAND, out returnObjectMock)).Do(x => x[1] = returnObjectMock); debuggerMock = Substitute.For <SbDebugger>(); debuggerMock.GetCommandInterpreter().Returns(commandInterpreterMock); commandWindowText = ""; commandWindowMock = Substitute.For <IVsCommandWindow>(); commandWindowMock.Print(Arg.Do <string>(x => commandWindowText += x)); commandWindowWriter = new CommandWindowWriter(taskContext, commandWindowMock); shell = new YetiVSI.LLDBShell.LLDBShell(taskContext, commandWindowWriter); shell.AddDebugger(debuggerMock); }
public void SetUp() { logSpy = new LogSpy(); logSpy.Attach(); var taskContext = new JoinableTaskContext(); shellMock = Substitute.For <ILLDBShell>(); commandWindowText = ""; commandWindowMock = Substitute.For <IVsCommandWindow>(); commandWindowMock.Print(Arg.Do <string>(x => commandWindowText += x)); serviceProviderMock = Substitute.For <IServiceProvider>(); yetiOptions = Substitute.For <OptionPageGrid>(); var yetiService = new YetiVSIService(yetiOptions); serviceProviderMock.GetService(typeof(YetiVSIService)).Returns(yetiService); serviceProviderMock.GetService(typeof(SLLDBShell)).Returns(shellMock); serviceProviderMock.GetService(typeof(SVsCommandWindow)).Returns(commandWindowMock); menuCommandService = new OleMenuCommandService(serviceProviderMock); serviceProviderMock.GetService(typeof(IMenuCommandService)).Returns(menuCommandService); LLDBShellCommandTarget.Register(taskContext, serviceProviderMock); }
// Outputs an error message to the logs and a Command Window (if one exists). public void PrintErrorMsg(string message) { taskContext.ThrowIfNotOnMainThread(); Trace.WriteLine(message); commandWindow?.Print(message + Environment.NewLine); }
// Outputs a message to a Command Window (if one exists). public void Print(string message) { taskContext.ThrowIfNotOnMainThread(); if (commandWindow == null) { Trace.WriteLine( $"ERROR: No Command Window found to report message.{Environment.NewLine}" + $"{message}"); } else { commandWindow.Print(message); } }
public void SetUp() { logSpy = new LogSpy(); logSpy.Attach(); var taskContext = new JoinableTaskContext(); commandWindowText = ""; commandWindowMock = Substitute.For <IVsCommandWindow>(); commandWindowMock.Print(Arg.Do <string>(x => commandWindowText += x)); serviceProviderMock = Substitute.For <IServiceProvider>(); yetiService = new YetiVSIService(null); serviceProviderMock.GetService(typeof(YetiVSIService)).Returns(yetiService); serviceProviderMock.GetService(typeof(SVsCommandWindow)).Returns(commandWindowMock); debugEngineCommandsMock = Substitute.For <IDebugEngineCommands>(); // (internal): This needs to be a member variable since debugEngineManager tracks it // by weak reference only!. debugEngineMock = Substitute.For <IGgpDebugEngine>(); debugEngineMock.DebugEngineCommands.Returns(debugEngineCommandsMock); debugEngineManager = new DebugEngineManager(); debugEngineManager.AddDebugEngine(debugEngineMock); serviceProviderMock.GetService(typeof(SDebugEngineManager)) .Returns(debugEngineManager); menuCommandService = new OleMenuCommandService(serviceProviderMock); serviceProviderMock.GetService(typeof(IMenuCommandService)) .Returns(menuCommandService); DebuggerOptionsCommand.Register(taskContext, serviceProviderMock); }