Exemplo n.º 1
0
        public void MatchProgramWithNoArguments()
        {
            string commandline = HelperFunction.MakeCommandLine(String.Empty);
            Match  match       = this.Regex.Match(commandline);

            HelperFunction.ValidateApplication(match);
            HelperFunction.ValidateArguments(match, 0);
        }
Exemplo n.º 2
0
        public void MatchSingleArgument_01()
        {
            string commandline = HelperFunction.MakeCommandLine("-a=b");
            Match  match       = this.Regex.Match(commandline);

            HelperFunction.ValidateApplication(match);
            HelperFunction.ValidateArguments(match, 1);
            HelperFunction.ValidateParameter(match, 0, "a", "b");
        }
Exemplo n.º 3
0
        public void MatchSingleSwitch_03()
        {
            string commandline = HelperFunction.MakeCommandLine("/a");
            Match  match       = this.Regex.Match(commandline);

            HelperFunction.ValidateApplication(match);
            HelperFunction.ValidateArguments(match, 1);
            HelperFunction.ValidateParameter(match, 0, "a", String.Empty);
        }
Exemplo n.º 4
0
        public void MatchNestedString_02()
        {
            string commandline = HelperFunction.MakeCommandLine("--a \"'b c'\"");
            Match  match       = this.Regex.Match(commandline);

            HelperFunction.ValidateApplication(match);
            HelperFunction.ValidateArguments(match, 1);
            HelperFunction.ValidateParameter(match, 0, "a", "\"'b c'\"");
        }
Exemplo n.º 5
0
        public void MatchProgramName()
        {
            string commandline = HelperFunction.MakeCommandLine(String.Empty);

            Regex programName = new Regex(this.ApplicationRegex);
            Match match       = programName.Match(commandline);

            HelperFunction.ValidateApplication(match);
        }
Exemplo n.º 6
0
        public void MatchMixed_02()
        {
            string commandline = HelperFunction.MakeCommandLine("--a /b:\"'1 2'\"");
            Match  match       = this.Regex.Match(commandline);

            HelperFunction.ValidateApplication(match);
            HelperFunction.ValidateArguments(match, 2);
            HelperFunction.ValidateParameter(match, 0, "a", String.Empty);
            HelperFunction.ValidateParameter(match, 1, "b", "\"'1 2'\"");
        }
Exemplo n.º 7
0
        public void MatchMultiArgument_03()
        {
            string commandline = HelperFunction.MakeCommandLine("/a='1 2' -b:\"3 4\" --c test");
            Match  match       = this.Regex.Match(commandline);

            HelperFunction.ValidateApplication(match);
            HelperFunction.ValidateArguments(match, 3);
            HelperFunction.ValidateParameter(match, 0, "a", "'1 2'");
            HelperFunction.ValidateParameter(match, 1, "b", "\"3 4\"");
            HelperFunction.ValidateParameter(match, 2, "c", "test");
        }
Exemplo n.º 8
0
        public void MatchMultiSwitch_03()
        {
            string commandline = HelperFunction.MakeCommandLine("--a -b /c");
            Match  match       = this.Regex.Match(commandline);

            HelperFunction.ValidateApplication(match);
            HelperFunction.ValidateArguments(match, 3);
            HelperFunction.ValidateParameter(match, 0, "a", String.Empty);
            HelperFunction.ValidateParameter(match, 1, "b", String.Empty);
            HelperFunction.ValidateParameter(match, 2, "c", String.Empty);
        }
Exemplo n.º 9
0
        public void DefaultBooleanPropertyTest()
        {
            string      text = HelperFunction.MakeCommandLine("--someName:'SomeValue'");
            CommandLine c    = new CommandLine(text);

            Assertion.Assert(
                "The command line text failed to parse",
                c.TextIsValid);

            c.Bind(this);
            c.Resolve();
            Assertion.Assert(this.DefaultBooleanProperty);
        }
Exemplo n.º 10
0
        public void BooleanPropertyTest_04()
        {
            string      text = HelperFunction.MakeCommandLine("--Bp:'Yes'");
            CommandLine c    = new CommandLine(text);

            Assertion.Assert(
                "The command line text failed to parse",
                c.TextIsValid);

            c.Bind(this);
            c.Resolve();
            Assertion.Assert(this.BooleanProperty);
        }
Exemplo n.º 11
0
        public void BooleanFieldTest_03()
        {
            string      text = HelperFunction.MakeCommandLine("-booleanField='True'");
            CommandLine c    = new CommandLine(text);

            Assertion.Assert(
                "The command line text failed to parse",
                c.TextIsValid);

            c.Bind(this);
            c.Resolve();
            Assertion.Assert(this.BooleanField);
        }
Exemplo n.º 12
0
        public void ProgramNameText()
        {
            string text = HelperFunction.MakeCommandLine(String.Empty);

            CommandLine c = new CommandLine(text);

            Assertion.Assert(
                "The command line text failed to parse",
                c.TextIsValid);

            Assertion.Assert(
                "The program name is incorrect",
                c.ProgramName == HelperFunction.ApplicationName);
        }
Exemplo n.º 13
0
        public void EnumPropertyTest_02()
        {
            string      text = HelperFunction.MakeCommandLine("--ep:\"vALUe4\"");
            CommandLine c    = new CommandLine(text);

            Assertion.Assert(
                "The command line text failed to parse",
                c.TextIsValid);

            c.Bind(this);
            c.Resolve();
            Assertion.AssertEquals(
                "Wrong enumeration value observed",
                Enumeration.Value4,
                this.enumProperty);
        }
Exemplo n.º 14
0
        public void EnumFieldTest_01()
        {
            string      text = HelperFunction.MakeCommandLine("--enumField:'value1'");
            CommandLine c    = new CommandLine(text);

            Assertion.Assert(
                "The command line text failed to parse",
                c.TextIsValid);

            c.Bind(this);
            c.Resolve();
            Assertion.AssertEquals(
                "Wrong enumeration value observed",
                Enumeration.Value1,
                this.enumField);
        }
Exemplo n.º 15
0
 public void ComplainOnStrange_01()
 {
     Assertion.Assert(!this.Regex.IsMatch(
                          HelperFunction.MakeCommandLine("/a='1'extra")));
 }