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")); }
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")); }
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)); }