public void NotPresentDoesNotPerformAction()
        {
            var parameter = new FileConsoleParameter(new[] { "f" }, x => Program.f = x, "");

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

            Assert.AreEqual(Program.f, default);
            Assert.IsFalse(mapped);
        }
        public void CanParseLastParameter()
        {
            var parameter = new FileConsoleParameter(new[] { "f" }, x => Program.f = x, "");

            bool mapped = parameter.PerformMapping(new LinkedList <string>($"-aaa asdfsad -b -f {Environment.CurrentDirectory}/Meyer.Common.Console.dll".Split(' ')));

            Assert.IsNotNull(Program.f);
            Assert.AreEqual(Program.f.Name, "Meyer.Common.Console.dll");
            Assert.IsTrue(mapped);
        }
        public void CanParseRelativePath()
        {
            var parameter = new FileConsoleParameter(new[] { "f" }, x => Program.f = x, "");

            bool mapped = parameter.PerformMapping(new LinkedList <string>($"-f .{Path.DirectorySeparatorChar}Meyer.Common.Console.dll".Split(' ')));

            Assert.IsNotNull(Program.f);
            Assert.AreEqual(Program.f.FullName, $"{Environment.CurrentDirectory}{Path.DirectorySeparatorChar}Meyer.Common.Console.dll");
            Assert.IsTrue(mapped);
        }
        public void CanParseMultiple()
        {
            HashSet <FileInfo> fileInfos = new HashSet <FileInfo>();

            var parameter = new FileConsoleParameter(new[] { "f" }, x => fileInfos.Add(x), "");

            bool mapped = parameter.PerformMapping(new LinkedList <string>($"-f {Environment.CurrentDirectory}/Meyer.Common.Console.dll -f {Environment.CurrentDirectory}/Meyer.Common.Console.pdb".Split(' ')));

            Assert.AreEqual(2, fileInfos.Count);
            Assert.AreEqual(fileInfos.First().Name, "Meyer.Common.Console.dll");
            Assert.AreEqual(fileInfos.Last().Name, "Meyer.Common.Console.pdb");
            Assert.IsTrue(mapped);
        }
        public void ArgsRemovedOnSuccess()
        {
            var parameter = new FileConsoleParameter(new[] { "f" }, x => Program.f = x, "");

            var args = new LinkedList <string>($"-q -f {Environment.CurrentDirectory}/Meyer.Common.Console.dll -g".Split(' '));

            bool mapped = parameter.PerformMapping(args);

            Assert.IsTrue(mapped);
            Assert.AreEqual(2, args.Count);
            Assert.IsFalse(args.Contains("-f"));
            Assert.IsFalse(args.Contains("Meyer.Common.Console.dll"));
        }
        public void ToStringRequiredText()
        {
            var parameter = new FileConsoleParameter(new[] { "f", "file" }, x => Program.f = x, "aaaa", true);

            Assert.AreEqual("-f -file : (Required) aaaa", parameter.ToString());
        }