Exemple #1
0
        public void EmptyCommandLine()
        {
            CommandLineParseException exception = TestUtils.TestForError <CommandLineParseException>(
                () => new CommandLineTester().TestCommandLine(string.Empty),
                "Did not catch expected error.");

            Validate.Value.AreEqual(exception.Position, 0, "Error not found at correct index.");
        }
Exemple #2
0
        public void ParseDuplicateNamedArguments()
        {
            const string rawCommandLine = "hello -named1 value1 -named1 value2";

            CommandLineParseException exception = TestUtils.TestForError <CommandLineParseException>(
                () => new CommandLineTester().TestCommandLine(rawCommandLine),
                "Did not catch expected error.");

            Validate.Value.AreEqual(exception.Position, 22, "Error not found at correct index.");
        }
Exemple #3
0
        public void CommandNameWithArgumentStartToken()
        {
            const string rawCommandLine = "-hello -argument";

            CommandLineParseException exception = TestUtils.TestForError <CommandLineParseException>(
                () => new CommandLineTester().TestCommandLine(rawCommandLine),
                "Did not catch expected error.");

            Validate.Value.AreEqual(exception.Position, 0, "Error not found at correct index.");
        }
Exemple #4
0
        public void WhitespaceCommandLine()
        {
            const string rawCommandLine = "  \t  ";

            CommandLineParseException exception = TestUtils.TestForError <CommandLineParseException>(
                () => new CommandLineTester().TestCommandLine(rawCommandLine),
                "Did not catch expected error.");

            Validate.Value.AreEqual(exception.Position, 0, "Error not found at correct index.");
        }
Exemple #5
0
        public void NullArgumentName()
        {
            const string rawCommandLine = "hello - nextArgument";

            CommandLineParseException exception = TestUtils.TestForError <CommandLineParseException>(
                () => new CommandLineTester().TestCommandLine(rawCommandLine),
                "Did not catch expected error.");

            Validate.Value.AreEqual(exception.Position, 7, "Error not found at correct index.");
        }