Example #1
0
        public void TestCallbacksCalledOnlyOnSuccessfulParsing()
        {
            int a1_v = 0;

            var p = new Isotope.CommandLine.CommandLineParser();
            var a = p.AddPositionalParameter("a");
            var b = p.AddNamedParameter("b", Isotope.CommandLine.ParameterRequirement.Required);

            a.OnPostParse += (parser, arg) => { a1_v = 1; };

            string[] tokens = { "1", "x1" }; // b is missing
            try
            {
                p.Parse(tokens);
            }
            catch (Isotope.CommandLine.MissingRequiredParameterException)
            {
                // this is ok
            }
            catch (System.Exception)
            {
                // this is not
                throw;
            }
            Assert.AreEqual("1", a.Text);
            Assert.AreEqual(0, a1_v);
        }
Example #2
0
        public void TestPostParseCallbacks()
        {
            int a1_v = 0;
            int a2_v = 0;
            int b_v  = 0;

            var p = new Isotope.CommandLine.CommandLineParser();
            var a = p.AddPositionalParameter("a");
            var b = p.AddNamedParameter("b", Isotope.CommandLine.ParameterRequirement.Required);
            var c = p.AddNamedParameter("c", Isotope.CommandLine.ParameterRequirement.NotRequired);

            a.OnPostParse += (parser, arg) => { a1_v = 1; };

            a.OnPostParse += (parser, arg) => { a2_v = 2; };

            b.OnPostParse += (parser, arg) => { b_v = 3; };

            string[] tokens = { "1", "x1", "-c", "3", "x2", "-b", "2", "x3", "x4" };
            p.Parse(tokens);
            Assert.AreEqual("1", a.Text);
            Assert.AreEqual("2", b.Text);
            Assert.AreEqual("3", c.Text);
            Assert.AreEqual(1, a1_v);
            Assert.AreEqual(2, a2_v);
            Assert.AreEqual(3, b_v);
        }
Example #3
0
        public void TestUnknownArgNegativeNumber()
        {
            // Negative numbers should not be interpreted as arguments.
            var p = new Isotope.CommandLine.CommandLineParser();

            string[] tokens = { "1", "-2", "bar" };
            p.Parse(tokens);
        }
Example #4
0
        public void TestExcess3()
        {
            var p = new Isotope.CommandLine.CommandLineParser();
            var a = p.AddPositionalParameter("a");
            var b = p.AddNamedParameter("b", Isotope.CommandLine.ParameterRequirement.Required);

            string[] tokens = { "1", "x1", "-b", "2", "x2" };
            p.Parse(tokens);
            Assert.AreEqual("1", a.Text);
            Assert.AreEqual("2", b.Text);
        }
Example #5
0
        public void TestMethodEnumValues1()
        {
            var p = new Isotope.CommandLine.CommandLineParser();
            var a = p.AddPositionalParameter("a");
            var b = p.AddPositionalParameter("b");
            var c = p.AddPositionalParameter("c");

            p.Parse(new string[] { "Choice1", "choICE1", "choice2" });
            Assert.AreEqual(EFOO.Choice1, a.GetEnum <EFOO>());
            Assert.AreEqual(EFOO.Choice1, b.GetEnum <EFOO>());
            Assert.AreEqual(EFOO.Choice2, c.GetEnum <EFOO>());
        }
Example #6
0
        public void TestUnhandlesTokens1()
        {
            var p = new Isotope.CommandLine.CommandLineParser();
            var a = p.AddPositionalParameter("a");

            string[] tokens = { "1" };
            p.Parse(tokens);
            Assert.AreEqual(p.FindParameter("a"), a);
            Assert.AreEqual(p.FindParameter("x"), null);

            Assert.AreEqual(a.Text, "1");
        }
Example #7
0
        public void TestTwoPositionalArgs()
        {
            var p = new Isotope.CommandLine.CommandLineParser();
            var a = p.AddPositionalParameter("a");
            var b = p.AddPositionalParameter("b");

            string[] tokens = { "1", "2" };
            p.Parse(tokens);

            Assert.AreEqual(a.Text, "1");
            Assert.AreEqual(b.Text, "2");
        }
Example #8
0
        public void TestMethodDoubleValues1()
        {
            var p = new Isotope.CommandLine.CommandLineParser();
            var a = p.AddPositionalParameter("a");
            var b = p.AddPositionalParameter("b");
            var c = p.AddPositionalParameter("c");

            p.Parse(new string[] { "-2.1", "0.0", "1.1" });
            Assert.AreEqual(-2.1, a.GetDouble());
            Assert.AreEqual(0, b.GetDouble());
            Assert.AreEqual(1.1, c.GetDouble());
        }
Example #9
0
        public void TestValuesForEmptyStringParameterValues()
        {
            // positional args always take precedence in order over named args, even if they are named on the command line

            var p = new Isotope.CommandLine.CommandLineParser();
            var a = p.AddPositionalParameter("a");
            var b = p.AddNamedParameter("b", Isotope.CommandLine.ParameterRequirement.Required);

            string[] tokens = { "", "-b", "" };
            p.Parse(tokens);
            Assert.AreEqual("", a.Text);
            Assert.AreEqual("", b.Text);
        }
Example #10
0
        public void Test2PossibleValue()
        {
            var p = new Isotope.CommandLine.CommandLineParser();
            var a = p.AddPositionalParameter("a");

            a.PossibleValues = new string[] { "Hello", "World" };
            p.Parse(new string[] { "Hello" });
            Assert.AreEqual("Hello", a.Text);
            p.Parse(new string[] { "World" });
            Assert.AreEqual("World", a.Text);
            p.Parse(new string[] { "helLO" });
            Assert.AreEqual("helLO", a.Text);
        }
Example #11
0
        public void Test0PossibleValues()
        {
            // verify that adding zero possible values is possible

            var p = new Isotope.CommandLine.CommandLineParser();
            var a = p.AddPositionalParameter("a");

            a.PossibleValues = new string[] {};
            string[] tokens = { "foo" };
            p.Parse(tokens);

            Assert.AreEqual("foo", a.Text);
        }
Example #12
0
        public void TestNamedOptionalWithValue()
        {
            var p = new Isotope.CommandLine.CommandLineParser();
            var a = p.AddPositionalParameter("a");
            var b = p.AddNamedParameter("b", Isotope.CommandLine.ParameterRequirement.Required);
            var c = p.AddNamedParameter("c", Isotope.CommandLine.ParameterRequirement.NotRequired);

            string[] tokens = { "1", "x1", "-c", "3", "x2", "-b", "2", "x3", "x4" };
            p.Parse(tokens);
            Assert.AreEqual("1", a.Text);
            Assert.AreEqual("2", b.Text);
            Assert.AreEqual("3", c.Text);
        }
Example #13
0
        public void TestMethodYesNoValues1()
        {
            var p = new Isotope.CommandLine.CommandLineParser();
            var a = p.AddPositionalParameter("a");
            var b = p.AddPositionalParameter("b");
            var c = p.AddPositionalParameter("c");
            var d = p.AddPositionalParameter("d");

            p.Parse(new string[] { "y", "yes", "no", "n" });
            Assert.AreEqual(true, a.GetYesNo());
            Assert.AreEqual(true, b.GetYesNo());
            Assert.AreEqual(false, c.GetYesNo());
            Assert.AreEqual(false, d.GetYesNo());
        }
Example #14
0
        public void TestDuplicateNamedArgs()
        {
            bool caught = false;
            var p = new Isotope.CommandLine.CommandLineParser();
            p.AddNamedParameter("a", Isotope.CommandLine.ParameterRequirement.Required);
            try{p.AddNamedParameter("a", Isotope.CommandLine.ParameterRequirement.Required);}
            catch (Isotope.CommandLine.GrammarException )
            {
                caught = true;
            }

            if (caught == false)
            {
                Assert.Fail("Did not catch expected exception");
            }
        }
Example #15
0
        public void TestDuplicatePositionalArgNames()
        {
            bool caught = false;
            var p = new Isotope.CommandLine.CommandLineParser();
            p.AddPositionalParameter("a");
            try{p.AddPositionalParameter("a");}
            catch (Isotope.CommandLine.GrammarException )
            {
                caught = true;
            }

            if (caught == false)
            {
                Assert.Fail("Did not catch expected exception");
            }

        }
Example #16
0
        public void TestPositionalArgAndNamedArgHaveSameName()
        {
            bool caught = false;
            var  p      = new Isotope.CommandLine.CommandLineParser();

            p.AddNamedParameter("a", Isotope.CommandLine.ParameterRequirement.Required);
            try { p.AddNamedParameter("a", Isotope.CommandLine.ParameterRequirement.NotRequired); }
            catch (Isotope.CommandLine.GrammarException)
            {
                caught = true;
            }

            if (caught == false)
            {
                Assert.Fail("Did not catch expected exception");
            }
        }
Example #17
0
        public void TestDuplicatePositionalArgNames()
        {
            bool caught = false;
            var  p      = new Isotope.CommandLine.CommandLineParser();

            p.AddPositionalParameter("a");
            try{ p.AddPositionalParameter("a"); }
            catch (Isotope.CommandLine.GrammarException)
            {
                caught = true;
            }

            if (caught == false)
            {
                Assert.Fail("Did not catch expected exception");
            }
        }
Example #18
0
        public void Test1PossibleValue()
        {
            bool caught = false;
            var  p      = new Isotope.CommandLine.CommandLineParser();
            var  a      = p.AddPositionalParameter("a");

            a.PossibleValues = new string[] { "Hello" };
            try { p.Parse(new string[] { "foo" }); }
            catch (Isotope.CommandLine.InvalidParameterValueException)
            {
                caught = true;
            }

            if (caught == false)
            {
                Assert.Fail("Did not catch expected exception");
            }
        }
Example #19
0
        public void TestMethodEnumValues2()
        {
            bool caught = false;
            var  p      = new Isotope.CommandLine.CommandLineParser();
            var  a      = p.AddPositionalParameter("a");

            p.Parse(new string[] { "foo" });
            try { var n = a.GetEnum <EFOO>(); }
            catch (System.ArgumentException)
            {
                caught = true;
            }

            if (caught == false)
            {
                Assert.Fail("Did not catch expected exception");
            }
        }
Example #20
0
        public void TestMissingPositionalArg1()
        {
            bool caught = false;
            var  p      = new Isotope.CommandLine.CommandLineParser();
            var  a      = p.AddPositionalParameter("a");

            string[] tokens = {};
            try { p.Parse(tokens); }
            catch (Isotope.CommandLine.MissingRequiredParameterException)
            {
                caught = true;
            }

            if (caught == false)
            {
                Assert.Fail("Did not catch expected exception");
            }
        }
Example #21
0
        public void TestMisingPositionalValueThrowsException()
        {
            // verifies that when the text value is missing, an exception is thrown

            bool caught = false;
            var  p      = new Isotope.CommandLine.CommandLineParser();
            var  a      = p.AddPositionalParameter("a");

            try { string s = a.Text; }
            catch (Isotope.CommandLine.RuntimeErrorException)
            {
                caught = true;
            }

            if (caught == false)
            {
                Assert.Fail("Did not catch expected exception");
            }
        }
Example #22
0
        public void TestMissingRequiredNamedArgThrowsException()
        {
            bool caught = false;
            var  p      = new Isotope.CommandLine.CommandLineParser();
            var  a      = p.AddPositionalParameter("a");
            var  b      = p.AddNamedParameter("b", Isotope.CommandLine.ParameterRequirement.Required);

            string[] tokens = { "1", "2" };
            try { p.Parse(tokens); }
            catch (Isotope.CommandLine.MissingRequiredParameterException)
            {
                caught = true;
            }

            if (caught == false)
            {
                Assert.Fail("Did not catch expected exception");
            }
        }
Example #23
0
        public void TestUnknownArg()
        {
            bool caught = false;
            var  p      = new Isotope.CommandLine.CommandLineParser();

            string[] tokens = { "1", "-foo", "bar" };
            try
            {
                p.Parse(tokens);
            }
            catch (Isotope.CommandLine.UnknownKeywordErrorException)
            {
                caught = true;
            }

            if (caught == false)
            {
                Assert.Fail("Did not catch expected exception");
            }
        }
Example #24
0
        public void TestPositionArgsTakePrecedence()
        {
            // positional args always take precedence in order over named args, even if they are named on the command line

            var p = new Isotope.CommandLine.CommandLineParser();
            var a = p.AddPositionalParameter("a");
            var b = p.AddNamedParameter("b", Isotope.CommandLine.ParameterRequirement.Required);
            var c = p.AddNamedParameter("c", Isotope.CommandLine.ParameterRequirement.NotRequired);

            string[] tokens = { "-c", "t1", "t2", "-b", "bv", "t5", "t6" };
            p.Parse(tokens);
            Assert.AreEqual("-c", a.Text);
            Assert.AreEqual("bv", b.Text);
            Assert.IsFalse(c.HasValue);
            var unnassigned = p.GetUnassignedTokens();

            Assert.AreEqual(4, unnassigned.Count);
            Assert.AreEqual("t1", unnassigned[0]);
            Assert.AreEqual("t2", unnassigned[1]);
            Assert.AreEqual("t5", unnassigned[2]);
            Assert.AreEqual("t6", unnassigned[3]);
        }
Example #25
0
        public void Test1PossibleValue()
        {
            bool caught = false;
            var p = new Isotope.CommandLine.CommandLineParser();
            var a = p.AddPositionalParameter("a");
            a.PossibleValues = new string[] {"Hello"};
            try {p.Parse(new string[] {"foo"});}
            catch (Isotope.CommandLine.InvalidParameterValueException )
            {
                caught = true;
            }

            if (caught == false)
            {
                Assert.Fail("Did not catch expected exception");
            }
        }
Example #26
0
        public void Test0PossibleValues()
        {
            // verify that adding zero possible values is possible

            var p = new Isotope.CommandLine.CommandLineParser();
            var a = p.AddPositionalParameter("a");
            a.PossibleValues = new string[] {};
            string[] tokens = {"foo"};
            p.Parse(tokens);

            Assert.AreEqual("foo", a.Text);
        }
Example #27
0
        public void TestCallbacksCalledOnlyOnSuccessfulParsing()
        {
            int a1_v = 0;

            var p = new Isotope.CommandLine.CommandLineParser();
            var a = p.AddPositionalParameter("a");
            var b = p.AddNamedParameter("b", Isotope.CommandLine.ParameterRequirement.Required);

            a.OnPostParse += (parser, arg) => { a1_v = 1; };

            string[] tokens = {"1", "x1"}; // b is missing
            try
            {
                p.Parse(tokens);
            }
            catch (Isotope.CommandLine.MissingRequiredParameterException)
            {
                // this is ok
            }
            catch (System.Exception)
            {
                // this is not
                throw;
            }
            Assert.AreEqual("1", a.Text);
            Assert.AreEqual(0, a1_v);
        }
Example #28
0
        public void TestMisingPositionalValueThrowsException()
        {
            // verifies that when the text value is missing, an exception is thrown

            bool caught = false;
            var p = new Isotope.CommandLine.CommandLineParser();
            var a = p.AddPositionalParameter("a");

            try {string s = a.Text;}
            catch (Isotope.CommandLine.RuntimeErrorException )
            {
                caught = true;
            }

            if (caught == false)
            {
                Assert.Fail("Did not catch expected exception");
            }
        }
Example #29
0
        public void TestCreateNamedRequiredArg()
        {
            var p = new Isotope.CommandLine.CommandLineParser();

            p.AddNamedParameter("a", Isotope.CommandLine.ParameterRequirement.Required);
        }
Example #30
0
        public void TestMethodEnumValues2()
        {
            bool caught = false;
            var p = new Isotope.CommandLine.CommandLineParser();
            var a = p.AddPositionalParameter("a");
            p.Parse(new string[] {"foo"});
            try {var n = a.GetEnum<EFOO>();}
            catch (System.ArgumentException )
            {
                caught = true;
            }

            if (caught == false)
            {
                Assert.Fail("Did not catch expected exception");
            }
        }
Example #31
0
 public void TestMethodYesNoValues1()
 {
     var p = new Isotope.CommandLine.CommandLineParser();
     var a = p.AddPositionalParameter("a");
     var b = p.AddPositionalParameter("b");
     var c = p.AddPositionalParameter("c");
     var d = p.AddPositionalParameter("d");
     p.Parse(new string[] {"y", "yes", "no", "n"});
     Assert.AreEqual(true, a.GetYesNo());
     Assert.AreEqual(true, b.GetYesNo());
     Assert.AreEqual(false, c.GetYesNo());
     Assert.AreEqual(false, d.GetYesNo());
 }
Example #32
0
 public void TestMethodDoubleValues1()
 {
     var p = new Isotope.CommandLine.CommandLineParser();
     var a = p.AddPositionalParameter("a");
     var b = p.AddPositionalParameter("b");
     var c = p.AddPositionalParameter("c");
     p.Parse(new string[] {"-2.1", "0.0", "1.1"});
     Assert.AreEqual(-2.1, a.GetDouble());
     Assert.AreEqual(0, b.GetDouble());
     Assert.AreEqual(1.1, c.GetDouble());
 }
Example #33
0
 public void TestCreateNamedRequiredArg()
 {
     var p = new Isotope.CommandLine.CommandLineParser();
     p.AddNamedParameter("a", Isotope.CommandLine.ParameterRequirement.Required);
 }
Example #34
0
        public void TestExcess3()
        {
            var p = new Isotope.CommandLine.CommandLineParser();
            var a = p.AddPositionalParameter("a");
            var b = p.AddNamedParameter("b", Isotope.CommandLine.ParameterRequirement.Required);

            string[] tokens = {"1", "x1", "-b", "2", "x2"};
            p.Parse(tokens);
            Assert.AreEqual("1", a.Text);
            Assert.AreEqual("2", b.Text);
        }
Example #35
0
        public void TestMissingRequiredNamedArgThrowsException()
        {
            bool caught = false;
            var p = new Isotope.CommandLine.CommandLineParser();
            var a = p.AddPositionalParameter("a");
            var b = p.AddNamedParameter("b", Isotope.CommandLine.ParameterRequirement.Required);

            string[] tokens = {"1", "2"};
            try {p.Parse(tokens);}
            catch (Isotope.CommandLine.MissingRequiredParameterException )
            {
                caught = true;
            }

            if (caught == false)
            {
                Assert.Fail("Did not catch expected exception");
            }
        }
Example #36
0
 public void TestCreatePositionalArg()
 {
     var p = new Isotope.CommandLine.CommandLineParser();
     p.AddPositionalParameter("a");
 }
Example #37
0
 public void TestCreateEmptyParser()
 {
     var p = new Isotope.CommandLine.CommandLineParser();
 }
Example #38
0
        public void TestUnknownArgNegativeNumber()
        {
            // Negative numbers should not be interpreted as arguments.
            var p = new Isotope.CommandLine.CommandLineParser();

            string[] tokens = {"1", "-2", "bar"};
            p.Parse(tokens);
        }
Example #39
0
 public void Test2PossibleValue()
 {
     var p = new Isotope.CommandLine.CommandLineParser();
     var a = p.AddPositionalParameter("a");
     a.PossibleValues = new string[] {"Hello", "World"};
     p.Parse(new string[] {"Hello"});
     Assert.AreEqual("Hello", a.Text);
     p.Parse(new string[] {"World"});
     Assert.AreEqual("World", a.Text);
     p.Parse(new string[] {"helLO"});
     Assert.AreEqual("helLO", a.Text);
 }
Example #40
0
        public void TestNamedOptionalWithValue()
        {
            var p = new Isotope.CommandLine.CommandLineParser();
            var a = p.AddPositionalParameter("a");
            var b = p.AddNamedParameter("b", Isotope.CommandLine.ParameterRequirement.Required);
            var c = p.AddNamedParameter("c", Isotope.CommandLine.ParameterRequirement.NotRequired);

            string[] tokens = {"1", "x1", "-c", "3", "x2", "-b", "2", "x3", "x4"};
            p.Parse(tokens);
            Assert.AreEqual("1", a.Text);
            Assert.AreEqual("2", b.Text);
            Assert.AreEqual("3", c.Text);
        }
Example #41
0
        public void TestCreatePositionalArg()
        {
            var p = new Isotope.CommandLine.CommandLineParser();

            p.AddPositionalParameter("a");
        }
Example #42
0
        public void TestPostParseCallbacks()
        {
            int a1_v = 0;
            int a2_v = 0;
            int b_v = 0;

            var p = new Isotope.CommandLine.CommandLineParser();
            var a = p.AddPositionalParameter("a");
            var b = p.AddNamedParameter("b", Isotope.CommandLine.ParameterRequirement.Required);
            var c = p.AddNamedParameter("c", Isotope.CommandLine.ParameterRequirement.NotRequired);

            a.OnPostParse += (parser, arg) => { a1_v = 1; };

            a.OnPostParse += (parser, arg) => { a2_v = 2; };

            b.OnPostParse += (parser, arg) => { b_v = 3; };

            string[] tokens = {"1", "x1", "-c", "3", "x2", "-b", "2", "x3", "x4"};
            p.Parse(tokens);
            Assert.AreEqual("1", a.Text);
            Assert.AreEqual("2", b.Text);
            Assert.AreEqual("3", c.Text);
            Assert.AreEqual(1, a1_v);
            Assert.AreEqual(2, a2_v);
            Assert.AreEqual(3, b_v);
        }
Example #43
0
 public void TestMethodEnumValues1()
 {
     var p = new Isotope.CommandLine.CommandLineParser();
     var a = p.AddPositionalParameter("a");
     var b = p.AddPositionalParameter("b");
     var c = p.AddPositionalParameter("c");
     p.Parse(new string[] {"Choice1", "choICE1", "choice2"});
     Assert.AreEqual(EFOO.Choice1, a.GetEnum<EFOO>());
     Assert.AreEqual(EFOO.Choice1, b.GetEnum<EFOO>());
     Assert.AreEqual(EFOO.Choice2, c.GetEnum<EFOO>());
 }
Example #44
0
        public void TestPositionArgsTakePrecedence()
        {
            // positional args always take precedence in order over named args, even if they are named on the command line

            var p = new Isotope.CommandLine.CommandLineParser();
            var a = p.AddPositionalParameter("a");
            var b = p.AddNamedParameter("b", Isotope.CommandLine.ParameterRequirement.Required);
            var c = p.AddNamedParameter("c", Isotope.CommandLine.ParameterRequirement.NotRequired);

            string[] tokens = {"-c", "t1", "t2", "-b", "bv", "t5", "t6"};
            p.Parse(tokens);
            Assert.AreEqual("-c", a.Text);
            Assert.AreEqual("bv", b.Text);
            Assert.IsFalse(c.HasValue);
            var unnassigned = p.GetUnassignedTokens();
            Assert.AreEqual(4, unnassigned.Count);
            Assert.AreEqual("t1", unnassigned[0]);
            Assert.AreEqual("t2", unnassigned[1]);
            Assert.AreEqual("t5", unnassigned[2]);
            Assert.AreEqual("t6", unnassigned[3]);
        }
Example #45
0
        public void TestUnknownArg()
        {
            bool caught = false;
            var p = new Isotope.CommandLine.CommandLineParser();

            string[] tokens = {"1", "-foo", "bar"};
            try
            {
                p.Parse(tokens);
            }
            catch (Isotope.CommandLine.UnknownKeywordErrorException )
            {
                caught = true;
            }

            if (caught == false)
            {
                Assert.Fail("Did not catch expected exception");
            }

        }
Example #46
0
        public void TestValuesForEmptyStringParameterValues()
        {
            // positional args always take precedence in order over named args, even if they are named on the command line

            var p = new Isotope.CommandLine.CommandLineParser();
            var a = p.AddPositionalParameter("a");
            var b = p.AddNamedParameter("b", Isotope.CommandLine.ParameterRequirement.Required);

            string[] tokens = {"", "-b", ""};
            p.Parse(tokens);
            Assert.AreEqual("", a.Text);
            Assert.AreEqual("", b.Text);
        }
Example #47
0
        public void TestUnhandlesTokens1()
        {
            var p = new Isotope.CommandLine.CommandLineParser();
            var a = p.AddPositionalParameter("a");

            string[] tokens = {"1"};
            p.Parse(tokens);
            Assert.AreEqual(p.FindParameter("a"), a);
            Assert.AreEqual(p.FindParameter("x"), null);

            Assert.AreEqual(a.Text, "1");
        }
Example #48
0
 public void TestCreateEmptyParser()
 {
     var p = new Isotope.CommandLine.CommandLineParser();
 }
Example #49
0
        public void TestMissingPositionalArg1()
        {
            bool caught = false;
            var p = new Isotope.CommandLine.CommandLineParser();
            var a = p.AddPositionalParameter("a");

            string[] tokens = {};
            try {p.Parse(tokens);}
            catch (Isotope.CommandLine.MissingRequiredParameterException )
            {
                caught = true;
            }

            if (caught == false)
            {
                Assert.Fail("Did not catch expected exception");
            }
        }
Example #50
0
        public void TestTwoPositionalArgs()
        {
            var p = new Isotope.CommandLine.CommandLineParser();
            var a = p.AddPositionalParameter("a");
            var b = p.AddPositionalParameter("b");

            string[] tokens = {"1", "2"};
            p.Parse(tokens);

            Assert.AreEqual(a.Text, "1");
            Assert.AreEqual(b.Text, "2");
        }