Exemplo n.º 1
0
 public void DumpControls()
 {
     InstallerEditorExeUtils.RunOptions options = new InstallerEditorExeUtils.RunOptions();
     using (Process p = InstallerEditorExeUtils.Detach(options))
     {
         Thread.Sleep(2000);
         p.WaitForInputIdle();
         UIAutomation.DumpControl(AutomationElement.FromHandle(p.MainWindowHandle));
         p.CloseMainWindow();
         p.WaitForExit();
     }
 }
        public void TestRunFileDoesntExist()
        {
            //TODO: High: ok button on error window is not automatically clicked on windows 7 ultimate x64

            InstallerEditorExeUtils.RunOptions options = new InstallerEditorExeUtils.RunOptions();
            options.args = Guid.NewGuid().ToString();
            ProcessStartInfo pi = new ProcessStartInfo(InstallerEditorExeUtils.Executable, options.CommandLineArgs);
            using (Application installerEditor = Application.Launch(pi))
            {
                List<Window> windows = installerEditor.GetWindows();
                Assert.AreEqual(windows.Count, 2);
                Window errorWindow = windows[1];
                Assert.IsNotNull(errorWindow);
                Assert.AreEqual(errorWindow.Title, "Error");
                Button exitButton = UIAutomation.Find<Button>(errorWindow, "OK");
                exitButton.Click();
                while (!installerEditor.HasExited) Thread.Sleep(100);
                Assert.AreEqual(-2, installerEditor.Process.ExitCode);
            }
        }
 public void TestRunNoArguments()
 {
     InstallerEditorExeUtils.RunOptions options = new InstallerEditorExeUtils.RunOptions();
     InstallerEditorExeUtils.RunResult r = InstallerEditorExeUtils.Run(options);
     Assert.AreEqual("Installer Editor", r.WindowTitle);
     Assert.AreEqual(0, r.ExitCode);
 }
 public void TestRunHelp()
 {
     InstallerEditorExeUtils.RunOptions options = new InstallerEditorExeUtils.RunOptions();
     options.args = "/?";
     InstallerEditorExeUtils.RunResult r = InstallerEditorExeUtils.Run(options);
     Assert.AreEqual("Installer Editor Help", r.WindowTitle);
     Assert.AreEqual(2, r.ExitCode);
 }