Пример #1
0
        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);
        }
Пример #2
0
        public void ExecuteCommandWithNoCommandWindow()
        {
            // CommandWindowWriter grabs the SVsCommandWindow once in the constructor. If we change
            // the service provide mock we need to create a new CommandwindowWriter to pick up the
            // change.
            commandWindowWriter = new CommandWindowWriter(taskContext, null);
            shell = new YetiVSI.LLDBShell.LLDBShell(taskContext, commandWindowWriter);
            shell.AddDebugger(debuggerMock);

            shell.ExecuteCommand(DUMMY_COMMAND);

            Assert.That(logSpy.GetOutput(), Does.Contain(COMMAND_DESCRIPTION));
            Assert.That(logSpy.GetOutput(), Does.Contain(DUMMY_COMMAND));
        }