/// <summary>Test that multiple conf arguments can be used.</summary> /// <exception cref="System.Exception"/> public virtual void TestConfWithMultipleOpts() { string[] args = new string[2]; args[0] = "--conf=foo"; args[1] = "--conf=bar"; GenericOptionsParser g = new GenericOptionsParser(args); Assert.Equal("1st conf param is incorrect", "foo", g.GetCommandLine ().GetOptionValues("conf")[0]); Assert.Equal("2st conf param is incorrect", "bar", g.GetCommandLine ().GetOptionValues("conf")[1]); }
/// <summary>Test that options passed to the constructor are used.</summary> /// <exception cref="System.Exception"/> public virtual void TestCreateWithOptions() { // Create new option newOpt Option opt = OptionBuilder.Create("newOpt"); Options opts = new Options(); opts.AddOption(opt); // Check newOpt is actually used to parse the args string[] args = new string[2]; args[0] = "--newOpt"; args[1] = "7"; GenericOptionsParser g = new GenericOptionsParser(opts, args); Assert.Equal("New option was ignored", "7", g.GetCommandLine() .GetOptionValues("newOpt")[0]); }