Пример #1
0
        public void ParseShortAdjacentOptions()
        {
            var options = new BooleanSetOptions();
            bool result = base.Parser.ParseArguments(new string[] { "-ca", "-d65" }, options);

            base.AssertParserSuccess(result);
            Assert.IsTrue(options.BooleanThree);
            Assert.IsTrue(options.BooleanOne);
            Assert.IsFalse(options.BooleanTwo);
            Assert.AreEqual(65, options.NonBooleanValue);
            Console.WriteLine(options);
        }
        public void ParseShortLongOptions()
        {
            var options = new BooleanSetOptions();
            Result = base.Parser.ParseArguments(new string[] { "-b", "--double=9" }, options);

            ResultShouldBeTrue();
            options.BooleanTwo.Should().Be.True();
            options.BooleanOne.Should().Be.False();
            options.BooleanThree.Should().Be.False();
            options.NonBooleanValue.Should().Equal(9D);
            Console.WriteLine(options);
        }
        public void Parse_short_long_options()
        {
            var options = new BooleanSetOptions();
            var parser = new CommandLineParser();
            var result = parser.ParseArguments(new string[] { "-b", "--double=9" }, options);

            result.Should().BeTrue();
            options.BooleanTwo.Should().BeTrue();
            options.BooleanOne.Should().BeFalse();
            options.BooleanThree.Should().BeFalse();
            options.NonBooleanValue.Should().Be(9D);
            Console.WriteLine(options);
        }
Пример #4
0
        public void Parse_short_adjacent_options()
        {
            var options = new BooleanSetOptions();
            var parser = new Parser();
            var result = parser.ParseArguments(new string[] { "-ca", "-d65" }, options);

            result.Should().BeTrue();
            options.BooleanThree.Should().BeTrue();
            options.BooleanOne.Should().BeTrue();
            options.BooleanTwo.Should().BeFalse();
            options.NonBooleanValue.Should().Be(65D);
            Console.WriteLine(options);
        }
        public void ParseShortLongOptions()
        {
            var options = new BooleanSetOptions();
            Result = base.Parser.ParseArguments(new string[] { "-b", "--double=9" }, options);

            ResultShouldBeTrue();
            Assert.IsTrue(options.BooleanTwo);
            Assert.IsFalse(options.BooleanOne);
            Assert.IsFalse(options.BooleanThree);
            Assert.AreEqual(9, options.NonBooleanValue);
            Console.WriteLine(options);
        }