public override void Install(IDictionary mySavedState) { // <Snippet6> StringDictionary myStringDictionary = myInstallContext.Parameters; if (myStringDictionary.Count == 0) { Console.WriteLine("No parameters have been entered in the command line " + "hence, the install will take place in the silent mode"); } else { // <Snippet4> // <Snippet5> // Check whether the "LogtoConsole" parameter has been set. if (myInstallContext.IsParameterTrue("LogtoConsole") == true) { // Display the message to the console and add it to the logfile. myInstallContext.LogMessage("The 'Install' method has been called"); } // </Snippet5> // </Snippet4> } // </Snippet6> // The 'Install procedure should be added here. }
public void Should_Return_Parameter_True_For_Parameters() { var installContext = new InstallContext("/var/log/log.log", new[] { "/whatever", "/i", "-debug" }); Assert.IsTrue(installContext.IsParameterTrue("debug")); Assert.IsTrue(installContext.IsParameterTrue("Debug")); Assert.IsTrue(installContext.IsParameterTrue("i")); Assert.IsTrue(installContext.IsParameterTrue("I")); Assert.IsTrue(installContext.IsParameterTrue("whatever")); Assert.IsTrue(installContext.IsParameterTrue("Whatever")); }