Esempio n. 1
0
        public void ParseTwoUIntConsecutiveArrayUsingShortNames()
        {
            var options = new OptionsWithUIntArray();
            var result  = CommandLineParser.Default.ParseArguments(new string[] {
                "-s", "just a string",
                "-o", "10", "20", "30", "40",
                "-t", "11", "22", "33", "44",
                "-b"
            }, options);

            base.AssertParserSuccess(result);
            Assert.AreEqual("just a string", options.SomeStringValue);
            base.AssertArrayItemEqual(new uint[] { 10, 20, 30, 40 }, options.ArrayOne);
            base.AssertArrayItemEqual(new uint[] { 11, 22, 33, 44 }, options.ArrayTwo);
            Assert.AreEqual(true, options.SomeBooleanValue);
        }
        public void ParseTwoUIntConsecutiveArray()
        {
            var options = new OptionsWithUIntArray();
            Result = CommandLineParser.Default.ParseArguments(new string[] {
                "--somestr", "just a string",
                "--arrayone", "10", "20", "30", "40",
                "--arraytwo", "11", "22", "33", "44",
                "--somebool"
            }, options);

            ResultShouldBeTrue();
            options.SomeStringValue.Should().Equal("just a string");
            base.ElementsShouldBeEqual(new uint[] {10, 20, 30, 40}, options.ArrayOne);
            base.ElementsShouldBeEqual(new uint[] {11, 22, 33, 44}, options.ArrayTwo);
            options.SomeBooleanValue.Should().Be.True();
        }
        public void Parse_two_uint_consecutive_array_using_short_names()
        {
            var options = new OptionsWithUIntArray();
            var result = CommandLineParser.Default.ParseArguments(new string[] {
                "-s", "just a string",
                "-o", "10", "20", "30", "40",
                "-t", "11", "22", "33", "44",
                "-b"
            }, options);

            result.Should().BeTrue();
            options.SomeStringValue.Should().Be("just a string");
            base.ElementsShouldBeEqual(new uint[] {10, 20, 30, 40}, options.ArrayOne);
            base.ElementsShouldBeEqual(new uint[] {11, 22, 33, 44}, options.ArrayTwo);
            options.SomeBooleanValue.Should().BeTrue();
        }
        public void ParseTwoUIntConsecutiveArrayUsingShortNames()
        {
            var options = new OptionsWithUIntArray();
            var result = CommandLineParser.Default.ParseArguments(new string[] {
                "-s", "just a string",
                "-o", "10", "20", "30", "40",
                "-t", "11", "22", "33", "44",
                "-b"
            }, options);

            base.AssertParserSuccess(result);
            Assert.AreEqual("just a string", options.SomeStringValue);
            base.AssertArrayItemEqual(new uint[] {10, 20, 30, 40}, options.ArrayOne);
            base.AssertArrayItemEqual(new uint[] {11, 22, 33, 44}, options.ArrayTwo);
            Assert.AreEqual(true, options.SomeBooleanValue);
        }