コード例 #1
0
        public void SetUp()
        {
            _consoleInterface = new ConsoleInterfaceForTesting();
            _consoleInterface.BufferWidth = 80;
            _consoleInterface.WindowWidth = 80;

            _adapter = new ConsoleAdapter(_consoleInterface);
        }
コード例 #2
0
        public UnitTestConsole(string programName = null)
        {
            _consoleInterface = new ConsoleInterfaceForTesting();
            var errorPrefix = string.Format("{0}: ", programName ?? "error");

            _console = new ConsoleAdapter(_consoleInterface);
            _error = new ErrorAdapter(_consoleInterface, errorPrefix);
        }
コード例 #3
0
 public void SetUp()
 {
     _consoleOut = new ConsoleInterfaceForTesting();
     _writer = new ColourWriter(_consoleOut);
 }
コード例 #4
0
 public void SetUp()
 {
     Toolkit.GlobalReset();
     _consoleInterface = new ConsoleInterfaceForTesting();
     _adapter = new ConsoleAdapter(_consoleInterface);
 }
コード例 #5
0
        public void SetUp()
        {
            _posix = new CommandLineInterpreterConfiguration(CommandLineParserConventions.PosixConventions);
            _msDos = new CommandLineInterpreterConfiguration(CommandLineParserConventions.MsDosConventions);
            _msStd = new CommandLineInterpreterConfiguration(CommandLineParserConventions.MicrosoftStandard);
            Configure(_posix);
            Configure(_msDos);
            Configure(_msStd);

            _consoleOutInterface = new ConsoleInterfaceForTesting();
            _console = new ConsoleAdapter(_consoleOutInterface);
        }
コード例 #6
0
        public void SetUp()
        {
            _longText = "ABCDEF GHIJKLM NOPQRST UVWXYZ ABCDEF GHIJKLM NOPQRST UVWXYZ ABCDEF GHIJKLM NOPQRST UVWXYZ ABCDEF GHIJKLM NOPQRST UVWXYZ ABCDEF GHIJKLM NOPQRST UVWXYZ ABCDEF GHIJKLM NOPQRST UVWXYZ";

            _consoleInterface = new ConsoleInterfaceForTesting();
            _consoleInterface.BufferWidth = 80;
            _consoleInterface.WindowWidth = 80;

            _adapter = new ConsoleAdapter(_consoleInterface);
        }
コード例 #7
0
 public void SetUp()
 {
     _console = new ConsoleInterfaceForTesting();
 }
コード例 #8
0
 public void SetUp()
 {
     _consoleOut = new ConsoleInterfaceForTesting();
     Environment.ExitCode = 0;
 }
コード例 #9
0
        public void SetUp()
        {
            _interface = new ConsoleInterfaceForTesting();
            _adapter = new ConsoleAdapter(_interface);

            StringVal = null;
            IntVal = 0;

            _goodStream = MakeStream(new [] {"text", "45"});
            _stringOnlyStream = MakeStream(new [] {"text"});
            _selectStream = MakeStream(new [] {"bad", "2", "C"});
            _validationStream = MakeStream(new[] { "2", "10", "11" });
        }
        public void SetUp()
        {
            _config = new CommandLineInterpreterConfiguration();
            _config.Command("first", s => new TestCommand())
                .Description("Description of the first commmand.");
            _config
                .Command("second", s => new TestCommand())
                .Description("The second command is a command with a number of parameters.")
                .Positional<string>("dateofthing", (command, s) => { })
                    .Description("The date the thing should have.")
                .Positional<string>("numberofthing", (command, s) => { })
                    .Description("The number of things that should be.");
            _config
                .Command("third", s => new TestCommand())
                .Description("The third command has a number of options but no parameters.")
                .Option("on", (command, b) => { })
                    .Description("A simple option with no argument.")
                .Option<string, int>("fiddly", (command, s, n) => { })
                    .Alias("f")
                    .Description("An option with two arguments. The arguments need to be described in the text.");
            _config
                .Command("fourth", s => new TestCommand())
                .Description("The fourth command is really complicated with a number of parameters and also options. This is the sort of command that needs lots of text.")
                .Positional<string>("date", (command, s) => { })
                    .Description("The date the complicated nonsense should be forgotten.")
                .Positional<string>("crpyticnum", (command, s) => { })
                    .Description("The amount of nonsense the user needs to forget.")
                .Option("ignore", (command, b) => { })
                    .Description("Use this option to consign this command to history, where it belongs.")
                .Option<string, int>("more", (command, s, n) => { })
                    .Description("Even more.");

            _config
                .Command("desc", s => new TestCommand())
                .Description(
                    @"Descriptions can contain embedded line breaks -->
            <-- like that one. These should be respected in the formatting. (This is meant to look a bit odd. Also, you should be aware that the deliberate line break is the only one in this text.)")
                .Positional<string>("pos", (command, s) => { })
                    .Description(@"A parameter with
            a line break.")
                .Option("lb", (command, b) => { })
                    .Description("Another\nbreak.");

            _config
                .Command("exp", s => new TestCommand())
                .Description(@"Command with a positional and options configured using a Linq Expression, not a lambda.")
                .Positional("pos", command => command.StringProp)
                    .Description(@"A positional configured with an expression.")
                .Option("B", command => command.BoolProp)
                    .Description("A boolean option configured with an expression.")
                .Option("I", command => command.IntProp)
                    .Description("A boolean option configured with an expression.");

            _customParser = new CustomParser();

            _consoleOutInterface = new ConsoleInterfaceForTesting();
            _console = new ConsoleAdapter(_consoleOutInterface);

            _console.WriteLine(RulerFormatter.MakeRuler(40));
        }
コード例 #11
0
 public void SetUp()
 {
     Toolkit.GlobalReset();
     _consoleInterface = new ConsoleInterfaceForTesting();
     _adapter = new ConsoleOperationsImpl(_consoleInterface);
     _prefixAdapter = new ConsoleOperationsImpl(_consoleInterface, "prefix: ");
 }
コード例 #12
0
 public void SetUp()
 {
     _testConsole = new ConsoleInterfaceForTesting();
     _console = new ConsoleAdapter(_testConsole);
     _error = new ErrorAdapter(_testConsole, "ERROR: ");
     _app = FakeApplication.MakeFakeApplication(_console, _error, typeof(StartCommand), typeof(Command1), typeof(Command2), typeof(Command3), typeof(ExitCommand), typeof(SetPromptCommand));
 }
コード例 #13
0
 public void SetUp()
 {
     _outInterface = new ConsoleInterfaceForTesting();
     _adapter = new ConsoleAdapter(_outInterface);
     _stream = new ConsoleAdapterStream(_adapter);
 }
コード例 #14
0
        public void SetUp()
        {
            _interface = new ConsoleInterfaceForTesting();

            StringVal = null;
            IntVal = 0;
        }