public void AllowSingleDashAsNonOptionValue()
        {
            var options = new SimpleOptionsWithValueList();
            Result = base.Parser.ParseArguments(new string[] { "-sparser.xml", "-", "--switch" }, options);

            ResultShouldBeTrue();
            options.StringValue.Should().Equal("parser.xml");
            options.BooleanValue.Should().Be.True();
            options.Items.Count.Should().Equal(1);
            options.Items[0].Should().Equal("-");
        }
        public void AllowSingleDashAsNonOptionValue()
        {
            var options = new SimpleOptionsWithValueList();
            bool result = base.Parser.ParseArguments(new string[] { "-sparser.xml", "-", "--switch" }, options);

            base.AssertParserSuccess(result);
            Assert.AreEqual("parser.xml", options.StringValue);
            Assert.AreEqual(true, options.BooleanValue);
            Assert.AreEqual(1, options.Items.Count);
            Assert.AreEqual("-", options.Items[0]);
        }
        public void Allow_single_dash_as_non_option_value()
        {
            var options = new SimpleOptionsWithValueList();
            var parser = new CommandLineParser();
            var result = parser.ParseArguments(new string[] { "-sparser.xml", "-", "--switch" }, options);

            result.Should().BeTrue();
            options.StringValue.Should().Be("parser.xml");
            options.BooleanValue.Should().BeTrue();
            options.Items.Count.Should().Be(1);
            options.Items[0].Should().Be("-");
        }
        public void ValueListAttributeIsolatesNonOptionValues()
        {
            var options = new SimpleOptionsWithValueList();
            bool result = base.Parser.ParseArguments(
                new string[] { "--switch", "file1.ext", "file2.ext", "file3.ext", "-s", "out.ext" }, options);

            base.AssertParserSuccess(result);
            Assert.AreEqual("file1.ext", options.Items[0]);
            Assert.AreEqual("file2.ext", options.Items[1]);
            Assert.AreEqual("file3.ext", options.Items[2]);
            Assert.AreEqual("out.ext", options.StringValue);
            Assert.IsTrue(options.BooleanValue);
            Console.WriteLine(options);
        }
        public void ValueListAttributeIsolatesNonOptionValues()
        {
            var options = new SimpleOptionsWithValueList();
            Result = base.Parser.ParseArguments(
                new string[] { "--switch", "file1.ext", "file2.ext", "file3.ext", "-s", "out.ext" }, options);

            ResultShouldBeTrue();
            options.Items[0].Should().Equal("file1.ext");
            options.Items[1].Should().Equal("file2.ext");
            options.Items[2].Should().Equal("file3.ext");
            options.StringValue.Should().Equal("out.ext");
            options.BooleanValue.Should().Be.True();
            Console.WriteLine(options);
        }
        public void Value_list_attribute_isolates_non_option_values()
        {
            var options = new SimpleOptionsWithValueList();
            var parser = new Parser();
            var result = parser.ParseArguments(
                new string[] { "--switch", "file1.ext", "file2.ext", "file3.ext", "-s", "out.ext" }, options);

            result.Should().BeTrue();

            options.Items[0].Should().Be("file1.ext");
            options.Items[1].Should().Be("file2.ext");
            options.Items[2].Should().Be("file3.ext");
            options.StringValue.Should().Be("out.ext");
            options.BooleanValue.Should().BeTrue();
            Console.WriteLine(options);
        }