public void ShouldRecreateUnparsedArgument7() { var args = new[] { "positional argument", "--port=8888", "--wrong-arg" }; var parser = new OptionsParser(); parser.WithOption <int>("port"); var options = new OptionsWithMultipleArguments(); parser.Parse(options, args); Assert.AreEqual("positional argument", options.Value); Assert.AreEqual(1, parser.ParsedOptions.Count()); Assert.AreEqual("port", parser.ParsedOptions.ToArray()[0].Flag.LongName); Assert.AreEqual(8888, parser.ParsedOptions.ToArray()[0].Value); Assert.AreEqual(1, parser.UnexpectedArguments.Count()); Assert.AreEqual("wrong-arg", parser.UnexpectedArguments.ElementAt(0).Value); Assert.AreEqual("--wrong-arg", parser.RecreateUnparsedArguments()); }
public void ShouldRecreateUnparsedArgument3() { var args = new[] { "positional argument", "-p8888", "--wrong-arg" }; var parser = new OptionsParser(); parser.WithOption <int>('p'); var options = new OptionsWithMultipleArguments(); parser.Parse(options, args); Assert.AreEqual("positional argument", options.Value); Assert.AreEqual(1, parser.ParsedOptions.Count()); Assert.AreEqual('p', parser.ParsedOptions.First().Flag.ShortName); Assert.AreEqual(8888, parser.ParsedOptions.First().Value); Assert.AreEqual(1, parser.UnexpectedArguments.Count()); Assert.AreEqual("wrong-arg", parser.UnexpectedArguments.ElementAt(0).Value); Assert.AreEqual("--wrong-arg", parser.RecreateUnparsedArguments()); }