public void ParsingThreeMutuallyExclusiveOptionsInTwoSetFails()
        {
            var  options = new OptionsWithMultipleSet();
            bool result  = base.Parser.ParseArguments(new string[] { "-g167", "--hue", "205", "--saturation=37" }, options);

            base.AssertParserFailure(result);
        }
Exemplo n.º 2
0
        public void Default_doesnt_support_mutually_exclusive_options()
        {
            var  options = new OptionsWithMultipleSet();
            bool result  = CommandLine.Parser.Default.ParseArguments(
                new string[] { "-r1", "-g2", "-b3", "-h4", "-s5", "-v6" }, options);

            result.Should().BeTrue(); // enabling MutuallyExclusive option it would fails
        }
Exemplo n.º 3
0
        public void DefaultDoesntSupportMutuallyExclusiveOptions()
        {
            var  options = new OptionsWithMultipleSet();
            bool result  = CommandLineParser.Default.ParseArguments(
                new string[] { "-r1", "-g2", "-b3", "-h4", "-s5", "-v6" }, options);

            Assert.IsTrue(result); // enabling MutuallyExclusive option it would fails
        }
        public void ParsingTwoMutuallyExclusiveOptionsInTwoSetSucceeds()
        {
            var  options = new OptionsWithMultipleSet();
            bool result  = base.Parser.ParseArguments(new string[] { "-g167", "--hue", "205" }, options);

            base.AssertParserSuccess(result);
            Assert.AreEqual(167, options.Green);
            Assert.AreEqual(205, options.Hue);
        }
        public void Parsing_three_mutually_exclusive_options_in_two_set_fails()
        {
            var parser = new CommandLine.Parser(new ParserSettings {
                MutuallyExclusive = true
            });
            var options = new OptionsWithMultipleSet();
            var result  = parser.ParseArguments(new string[] { "-g167", "--hue", "205", "--saturation=37" }, options);

            result.Should().BeFalse();
        }
        public void Parsing_two_mutually_exclusive_options_in_two_set_succeeds()
        {
            var options = new OptionsWithMultipleSet();
            var parser  = new CommandLine.Parser(new ParserSettings {
                MutuallyExclusive = true
            });
            var result = parser.ParseArguments(new string[] { "-g167", "--hue", "205" }, options);

            result.Should().BeTrue();
            options.Green.Should().Be((byte)167);
            options.Hue.Should().Be((short)205);
        }