Ejemplo n.º 1
0
        public void TaskWithTagAndTagIntersectThrowAnExcption()
        {
            var commandLineParser       = new CommandLine.Parser();
            CommandLineParser parserObj = new CommandLineParser(new OptionConverter(new JsonDeserializer()), commandLineParser, new ParserUsage(), new VerbFormater());

            string[]       argv      = new string[] { "task info", "--tags", "t1", "t2", "--exclusive-tags", "t3", "t4" };
            ParseException ex        = null;
            var            converter = new OptionConverter(null);
            var            usage     = new ParserUsage();

            var parser = commandLineParser.ParseArguments <Options.InfoTaskOptions>(argv);

            ex = Assert.Throws <ParseException>(() => parser.MapResult(
                                                    (Options.InfoTaskOptions o) => converter.ConvertGenericGetterOption(ConfigType.Task, CommandApi.Info, o),
                                                    err => throw new ParseException(usage.PrintHelp(parser, err, argv))));

            Assert.IsNotNull(ex);
            commandLineParser.Dispose();
        }