GetArguments() public method

public GetArguments ( ) : string[]
return string[]
示例#1
0
        public void GetArguments() {
            string[] arguments = new string[]
                                 {
                                     "--help", "-d", "doc.xml",
                                     "/pet:cat"
                                 };
            ArgvConfigSource source = new ArgvConfigSource(arguments);

            source.AddSwitch("Base", "help", "h");
            source.AddSwitch("Base", "doc", "d");
            source.AddSwitch("Base", "short");

            string[] args = source.GetArguments();
            Assert.IsTrue(args != arguments); // must be a different instance
            Assert.AreEqual(4, args.Length);
            Assert.AreEqual("--help", args[0]);
            Assert.AreEqual("-d", args[1]);
            Assert.AreEqual("doc.xml", args[2]);
            Assert.AreEqual("/pet:cat", args[3]);
        }
        public void GetArguments()
        {
            string[] arguments = new string[]
            {
                "--help", "-d", "doc.xml",
                "/pet:cat"
            };
            ArgvConfigSource source = new ArgvConfigSource(arguments);

            source.AddSwitch("Base", "help", "h");
            source.AddSwitch("Base", "doc", "d");
            source.AddSwitch("Base", "short");

            string[] args = source.GetArguments();
            Assert.IsTrue(args != arguments); // must be a different instance
            Assert.AreEqual(4, args.Length);
            Assert.AreEqual("--help", args[0]);
            Assert.AreEqual("-d", args[1]);
            Assert.AreEqual("doc.xml", args[2]);
            Assert.AreEqual("/pet:cat", args[3]);
        }