Ejemplo n.º 1
0
        public void CmdWithoutPositionalsSucceeds()
        {
            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 positionals = cmd.GetPositionalParms().ToList();

            Assert.AreEqual(0, positionals.Count, "Positionals not zero");
        }
Ejemplo n.º 2
0
        public void CmdWithPositionalsSucceeds()
        {
            CmdFlag[] allowedFlags = { new CmdFlag("a", true) };
            CmdLine   cmd          = new CmdLine(allowedFlags);

            string[] args    = { "-aReqFlag", "Pos1", "$Pos2", "+Pos3" };
            bool     success = cmd.ProcessCmdLine(args); // parse the command line

            Assert.IsTrue(success, "success is false");
            var positionals = cmd.GetPositionalParms().ToList();

            Assert.AreEqual(3, positionals.Count, "Positionals not 3");
            Assert.AreEqual("Pos1", positionals[0], "Pos[0] not Pos1");
            Assert.AreEqual("$Pos2", positionals[1], "Pos[1] not $Pos2");
            Assert.AreEqual("+Pos3", positionals[2], "Pos[2] not +Pos3");
        }