public void CmdWithoutExtraneousSwitchesSucceeds() { CmdFlag[] allowedFlags = { new CmdFlag("a", true) }; CmdLine cmd = new CmdLine(allowedFlags); string[] args = { "-aReqFlag" }; bool success = cmd.ProcessCmdLine(args); // parse the command line Assert.IsTrue(success, "success is false"); var extra = cmd.GetExtraneousParms().ToList(); Assert.AreEqual(0, extra.Count, "Extra parm count not zero"); }
public void CmdWithExtraneousParmsSucceeds() { CmdFlag[] allowedFlags = { new CmdFlag("a", true) }; CmdLine cmd = new CmdLine(allowedFlags); string[] args = { "-aReqFlag", "-bParm2", "-cParm3" }; bool success = cmd.ProcessCmdLine(args); // parse the command line Assert.IsTrue(success, "success is false"); var extra = cmd.GetExtraneousParms().ToList(); Assert.AreEqual(2, extra.Count, "Extraneous count not 2"); Assert.AreEqual("bParm2", extra[0], "extra[0] not bParm2"); Assert.AreEqual("cParm3", extra[1], "extra[1] not cParm3"); }