Exemplo n.º 1
0
        public void CommandLineBasicParsing()
        {
            string[] clParams = new string[] {
                "--LogLevel",
                "Debug",
                "--ConfigFile",
                "aSiteValue"
            };
            AppParams parms = new AppParams(clParams);

            Assert.That(parms.HasParam("LogLevel"));
            Assert.That(parms.HasParam("ConfigFile"));
            Assert.That(parms.P <string>("LogLevel").Equals("Debug"));
            Assert.That(parms.P <string>("ConfigFile").Equals("aSiteValue"));
        }
Exemplo n.º 2
0
        public void CommandLineBooleanWithoutValue()
        {
            string[] clParams = new string[] {
                "--LogLevel",
                "Debug",
                "--quiet",
                "true",
                "--verbose",
                "--ConfigFile",
                "aSiteValue"
            };
            AppParams parms = new AppParams(clParams);

            Assert.That(parms.HasParam("LogLevel"));
            Assert.That(parms.HasParam("ConfigFile"));
            Assert.That(parms.P <string>("LogLevel").Equals("Debug"));
            Assert.That(parms.P <string>("ConfigFile").Equals("aSiteValue"));
            Assert.That(parms.P <bool>("Verbose"));
        }
Exemplo n.º 3
0
        public void CommandLineBooleanNegation()
        {
            string[] clParams = new string[] {
                "--LogLevel",
                "Debug",
                "--quiet",
                "true",
                "--noverbose",
                "--ConfigFile",
                "aSiteValue"
            };
            AppParams parms = new AppParams(clParams);

            Assert.That(parms.HasParam("LogLevel"));
            Assert.That(parms.HasParam("ConfigFile"));
            Assert.That(parms.P <string>(AppParams.P_LOGLEVEL).Equals("Debug"));
            Assert.That(parms.P <string>(AppParams.P_CONFIGFILE).Equals("aSiteValue"));
            Assert.That(parms.P <bool>(AppParams.P_QUIET));
            Assert.That(!parms.P <bool>(AppParams.P_VERBOSE));
        }