Example #1
0
        public void Setup()
        {
            outStream = new MemoryStream();
            errStream = new MemoryStream();

            shell           = new ConsoleShell("unittest.exe");
            shell.OutWriter = new StreamWriter(outStream, new UTF8Encoding(false));
            shell.ErrWriter = new StreamWriter(errStream, new UTF8Encoding(false));
            shell.Banner    = "Unit test console";

            IConsoleCommand mockCommand = MockRepository.GenerateStub <IConsoleCommand>();

            mockCommand.Stub(x => x.CommandId).Return("cmd1");
            mockCommand.Stub(x => x.Description).Return("performs action 1");
            mockCommand.Stub(x => x.ConstructUsageHelpText(null)).IgnoreArguments()
            .Return(@"   something to be used
   bla bla");

            shell.RegisterCommand(mockCommand);

            TestStandardConsoleCommand cmd2 = new TestStandardConsoleCommand();

            shell.RegisterCommand(cmd2);
        }