public void CanAssignMultipleFlags()
        {
            var parameter = new ActionConsoleParameter(new[] { "i", "int" }, x => Program.i = int.Parse(x), "");

            bool mapped1 = parameter.PerformMapping(new LinkedList <string>("-i 5".Split(' ')));

            Assert.AreEqual(5, Program.i);
            Assert.IsTrue(mapped1);

            bool mapped2 = parameter.PerformMapping(new LinkedList <string>("-int 5".Split(' ')));

            Assert.AreEqual(5, Program.i);
            Assert.IsTrue(mapped2);
        }
        public void CanParseLastParameter()
        {
            var parameter = new ActionConsoleParameter(new[] { "i" }, x => Program.i = int.Parse(x), "");

            bool mapped = parameter.PerformMapping(new LinkedList <string>("-aaa asdfsad -b -i 5".Split(' ')));

            Assert.AreEqual(5, Program.i);
            Assert.IsTrue(mapped);
        }
        public void CanParseMultiple()
        {
            var parameter = new ActionConsoleParameter(new[] { "i" }, x => Program.i += int.Parse(x), "");

            bool mapped = parameter.PerformMapping(new LinkedList <string>("-i 5 -i 10".Split(' ')));

            Assert.AreEqual(15, Program.i);
            Assert.IsTrue(mapped);
        }
        public void NotPresentDoesNotPerformAction()
        {
            var parameter = new ActionConsoleParameter(new[] { "i" }, x => Program.i = int.Parse(x), "");

            bool mapped = parameter.PerformMapping(new LinkedList <string>("".Split(' ')));

            Assert.AreEqual(Program.i, default);
            Assert.IsFalse(mapped);
        }
        public void ArgsRemovedOnSuccess()
        {
            var parameter = new ActionConsoleParameter(new[] { "i" }, x => Program.i = int.Parse(x), "");

            var args = new LinkedList <string>("-q -i 5 -g".Split(' '));

            bool mapped = parameter.PerformMapping(args);;

            Assert.AreEqual(5, Program.i);
            Assert.IsTrue(mapped);
            Assert.AreEqual(2, args.Count);
            Assert.IsFalse(args.Contains("-i"));
            Assert.IsFalse(args.Contains("5"));
        }