Exemple #1
0
        public void ParseOptionList()
        {
            var  options = new SimpleOptionsWithOptionList();
            bool result  = base.Parser.ParseArguments(new string[] {
                "-k", "string1:stringTwo:stringIII", "-s", "test-file.txt"
            }, options);

            base.AssertParserSuccess(result);
            Assert.AreEqual("string1", options.SearchKeywords[0]);
            Console.WriteLine(options.SearchKeywords[0]);
            Assert.AreEqual("stringTwo", options.SearchKeywords[1]);
            Console.WriteLine(options.SearchKeywords[1]);
            Assert.AreEqual("stringIII", options.SearchKeywords[2]);
            Console.WriteLine(options.SearchKeywords[2]);
            Assert.AreEqual("test-file.txt", options.StringValue);
            Console.WriteLine(options.StringValue);
        }
Exemple #2
0
        public void Parse_option_list()
        {
            var options = new SimpleOptionsWithOptionList();
            var parser  = new CommandLine.Parser();
            var result  = parser.ParseArguments(new string[] {
                "-k", "string1:stringTwo:stringIII", "-s", "test-file.txt"
            }, options);

            result.Should().BeTrue();
            options.SearchKeywords[0].Should().Be("string1");
            Console.WriteLine(options.SearchKeywords[0]);
            options.SearchKeywords[1].Should().Be("stringTwo");
            Console.WriteLine(options.SearchKeywords[1]);
            options.SearchKeywords[2].Should().Be("stringIII");
            Console.WriteLine(options.SearchKeywords[2]);
            options.StringValue.Should().Be("test-file.txt");
            Console.WriteLine(options.StringValue);
        }