Пример #1
0
        public void GetParameterAndSwitch_MultiSwitch_WorksProperly()
        {
            string[] arguments = { "file1.txt", "-rf", "--help" };
            var      reader    = new UnixShellArgumentReader(arguments, paramNames, switchNames);

            Assert.AreEqual("file1.txt", reader.GetArgument(0));
            Assert.IsNull(reader.GetArgument("-O"));
            Assert.IsNull(reader.GetArgument("-d,--depth"));
            Assert.IsTrue(reader.GetOption("-f,--force"));
            Assert.IsTrue(reader.GetOption("-r,--recursive"));
            Assert.IsTrue(reader.GetOption("-h,--help"));
        }
Пример #2
0
        public void GetParameterAndSwitch_MultiParam_WorksProperly()
        {
            string[] arguments = { "file1.txt", "-O", "file2.txt", "-f", "-O", "file3.txt", "-d", "0" };
            var      reader    = new UnixShellArgumentReader(arguments, paramNames, switchNames);

            Assert.AreEqual("file1.txt", reader.GetArgument(0));
            Assert.IsTrue(reader.GetArguments("-O").SequenceEqual(new[] { "file2.txt", "file3.txt" }));
            Assert.AreEqual("0", reader.GetArgument("-d,--depth"));
            Assert.IsTrue(reader.GetOption("-f,--force"));
            Assert.IsFalse(reader.GetOption("-r,--recursive"));
            Assert.IsFalse(reader.GetOption("-h,--help"));
        }