public void Should_parse_flags() { var testArgs = "--debug|--flag".ToArgsArray(); var parser = new SimpleParser(testArgs); Assert.True(parser.Flag("debug")); Assert.True(parser.Flag("flag")); Assert.That(parser.Arguments.Length, Is.EqualTo(0)); }
public void Should_parse_combination() { var testArgs = "argument1|--flag|--option|a value".ToArgsArray(); var parser = new SimpleParser(testArgs); Assert.True(parser.Flag("flag")); Assert.That(parser.Option("option"), Is.EqualTo("a value")); Assert.That(parser.Arguments.Length, Is.EqualTo(1)); Assert.That(parser.Arguments[0], Is.EqualTo("argument1")); }
public void Should_parse_arguments_from_anywhere() { var testArgs = "argument1|--flag|--option|a value|argument2".ToArgsArray(); var parser = new SimpleParser(testArgs); Assert.True(parser.Flag("flag")); Assert.That(parser.Option("option"), Is.EqualTo("a value")); Assert.That(parser.Arguments.Length, Is.EqualTo(2)); Assert.That(parser.Arguments[0], Is.EqualTo("argument1")); Assert.That(parser.Arguments[1], Is.EqualTo("argument2")); }