Exemplo n.º 1
0
        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");
        }
Exemplo n.º 2
0
        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");
        }