public void TestUserControlBrowseControlArgs() { Console.WriteLine("TestUserControlBrowseControlArgs"); // a configuration with a checkbox control ConfigFile configFile = new ConfigFile(); SetupConfiguration setupConfiguration = new SetupConfiguration(); configFile.Children.Add(setupConfiguration); ControlBrowse browse = new ControlBrowse(); browse.Text = "4"; browse.Id = "browse1"; setupConfiguration.Children.Add(browse); ComponentCmd cmd = new ComponentCmd(); cmd.command = "cmd.exe /C exit /b [browse1]"; cmd.required_install = true; setupConfiguration.Children.Add(cmd); // save config file string configFilename = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".xml"); Console.WriteLine("Writing '{0}'", configFilename); configFile.SaveAs(configFilename); // execute dotNetInstaller dotNetInstallerExeUtils.RunOptions options = new dotNetInstallerExeUtils.RunOptions(); options.configFile = configFilename; options.args = "/controlArgs browse1:4"; Assert.AreEqual(4, dotNetInstallerExeUtils.Run(options)); File.Delete(configFilename); }
public void TestUserControlBrowseDrive() { Console.WriteLine("TestUserControlBrowseDrive"); ConfigFile configFile = new ConfigFile(); SetupConfiguration setupConfiguration = new SetupConfiguration(); configFile.Children.Add(setupConfiguration); ControlBrowse browse = new ControlBrowse(); browse.Text = @"C:\"; browse.Id = "browse1"; setupConfiguration.Children.Add(browse); ComponentCmd cmd = new ComponentCmd(); cmd.command = "cmd.exe /C if \"[browse1]\"==\"C:\\\" ( exit /b 0 ) else ( exit /b 1 )"; setupConfiguration.Children.Add(cmd); // save config file string configFilename = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".xml"); Console.WriteLine("Writing '{0}'", configFilename); configFile.SaveAs(configFilename); // execute dotNetInstaller Assert.AreEqual(0, dotNetInstallerExeUtils.Run(configFilename)); File.Delete(configFilename); }