コード例 #1
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
        }
コード例 #2
0
 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);
 }
コード例 #3
0
        public void Parsing_three_mutually_exclusive_options_in_two_set_fails()
        {
            var parser = new Parser(new ParserSettings {MutuallyExclusive = true});
            var options = new OptionsWithMultipleSet();
            var result = parser.ParseArguments(new string[] { "-g167", "--hue", "205", "--saturation=37" }, options);

            result.Should().BeFalse();
        }