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); }
public void ParseOptionList() { var options = new SimpleOptionsWithOptionList(); Result = base.Parser.ParseArguments(new string[] { "-k", "string1:stringTwo:stringIII", "-s", "test-file.txt" }, options); ResultShouldBeTrue(); options.SearchKeywords[0].Should().Equal("string1"); Console.WriteLine(options.SearchKeywords[0]); options.SearchKeywords[1].Should().Equal("stringTwo"); Console.WriteLine(options.SearchKeywords[1]); options.SearchKeywords[2].Should().Equal("stringIII"); Console.WriteLine(options.SearchKeywords[2]); options.StringValue.Should().Equal("test-file.txt"); Console.WriteLine(options.StringValue); }
public void Parse_option_list() { var options = new SimpleOptionsWithOptionList(); var parser = new CommandLineParser(); 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); }