public void OneOrMultipleCommandFail() => Assert.Throws <CommandLineCheckException>( () => CommandLineHelper.Check( "program", new CmdLineRules( CommandQuantifier.OneOrMultiple, new[] { new CommandRule("cmd1"), new CommandRule("cmd2") })));
public void ZeroOrOneCommandFail() => Assert.Throws <CommandLineCheckException>( () => CommandLineHelper.Check( "program cmd1 cmd2", new CmdLineRules( CommandQuantifier.ZeroOrOne, new[] { new CommandRule("cmd1"), new CommandRule("cmd2") })));
public void LocalReqOptionFail() => Assert.Throws <CommandLineCheckException>( () => CommandLineHelper.Check( "program cmd1", new CmdLineRules( new[] { new CommandRule("cmd1") }, new[] { new OptionRule("opt1", OptionType.Bool, true, "cmd1") })));
public void Test01() => CommandLineHelper.Check( "program cmd1 cmd2 /opt1 /opt2+ /opt3=val3", new CmdLineRules( new [] { new CommandRule("cmd1"), new CommandRule("cmd2") }, new [] { new OptionRule("opt1", OptionType.Valueless), new OptionRule("opt2", OptionType.Bool), new OptionRule("opt3", OptionType.Value) }));
public void OptionsNoValue() => Assert.Throws <CommandLineCheckException>( () => CommandLineHelper.Check("program /opt1-", new CmdLineRules(new OptionRule("opt1", OptionType.Value))));
public void UnknownOptions() => Assert.Throws <CommandLineCheckException>( () => CommandLineHelper.Check("program /opt1 /opt2 /opt3", new CmdLineRules(new OptionRule("opt1"))));
public void UnknownCommands() => Assert.Throws <CommandLineCheckException>( () => CommandLineHelper.Check("program cmd1 cmd2 cmd3", new CmdLineRules(new CommandRule("cmd2"))));
public void LocalReqOption() => CommandLineHelper.Check( "program", new CmdLineRules(new OptionRule("opt1", OptionType.Bool, true, "cmd1")));
public void GlobalReqOption() => Assert.Throws <CommandLineCheckException>( () => CommandLineHelper.Check("program", new CmdLineRules(new OptionRule("opt1", OptionType.Bool, true))));
public void NoDepCommand() => Assert.Throws <CommandLineCheckException>( () => CommandLineHelper.Check( "program /opt1+", new CmdLineRules(new OptionRule("opt1", OptionType.Bool, true, "cmd1"))));