Example #1
0
        public void ParseStringArrayOptionUsingLongNameWithValueList()
        {
            var  options = new SimpleOptionsWithArrayAndValueList();
            bool result  = base.Parser.ParseArguments(new string[] {
                "-shere", "-i999", "--strarr=0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "--switch", "f1.xml", "f2.xml"
            }, options);

            base.AssertParserSuccess(result);
            Assert.AreEqual("here", options.StringValue);
            Assert.AreEqual(999, options.IntegerValue);
            base.AssertArrayItemEqual(new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" }, options.StringArrayValue);
            Assert.IsTrue(options.BooleanValue);
            base.AssertArrayItemEqual(new string[] { "f1.xml", "f2.xml" }, options.Items);
        }
        public void Parse_string_array_option_using_long_name_with_value_list()
        {
            var options = new SimpleOptionsWithArrayAndValueList();
            var parser  = new CommandLine.Parser();
            var result  = parser.ParseArguments(new string[] {
                "-shere", "-i999", "--strarr=0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "--switch", "f1.xml", "f2.xml"
            }, options);

            result.Should().BeTrue();
            options.StringValue.Should().Be("here");
            options.IntegerValue.Should().Be(999);
            base.ElementsShouldBeEqual(new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" }, options.StringArrayValue);
            options.BooleanValue.Should().BeTrue();
            base.ElementsShouldBeEqual(new string[] { "f1.xml", "f2.xml" }, options.Items);
        }