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 ExecuteCommandWithNullResult() { commandInterpreterMock.WhenForAnyArgs(x => x.HandleCommand(DUMMY_COMMAND, out returnObjectMock)).Do(x => x[1] = null); shell.ExecuteCommand(DUMMY_COMMAND); Assert.That(commandWindowText, Does.Contain("ERROR")); Assert.That(logSpy.GetOutput(), Does.Contain("ERROR")); }