public void TestHelpParameter() { IParameterParser processor; string[] commandline = {"--help"}; ParsedParameters output; processor = new UnixParameters(); processor.RegisterParameter<string>("run-scheduled-task", ParameterType.ValueRequired, new string[] { "run-scheduled-task" }, new string[] { "s" }); processor.RegisterParameter<string>("verbose", ParameterType.NoValue, new string[] { "verbose" }, new string[] { "v" }); processor.RegisterParameter<string>("quiet", ParameterType.NoValue, new string[] { "quiet" }, new string[] { "q" }); processor.RegisterParameter<string>("help", ParameterType.NoValue, new string[] { "help" }, new string[] { "h" }); output = processor.Parse(commandline); Assert.IsTrue(output.HasParameter("help"), "Help key is present"); }
/// <summary> /// <para>Creates and configures a <see cref="IParameterParser"/> instance for testing.</para> /// </summary> /// <param name="paramaterTwoType"> /// A <see cref="ParameterType"/> /// </param> /// <returns> /// A <see cref="IParameterParser"/> /// </returns> private IParameterParser SetUpParamaterParser(ParameterType paramaterTwoType) { IParameterParser output; output = new UnixParameters(); output.RegisterParameter<string>("one", ParameterType.NoValue, new string[] { "one" }, new string[] { "o" }); output.RegisterParameter<string>("two", paramaterTwoType, new string[] { "Number-Two" }, new string[] { "t" }); output.RegisterParameter<string>("three", ParameterType.NoValue, new string[] { "four" }, new string[] { "f" }); return output; }