Пример #1
0
        private static void Main(string[] args)
        {
            RunModes mode = RunModes.Gui;

            if (args == null || args.Length > 0)
            {
                if (System.IO.File.Exists(args[0]))
                {
                    mode = RunModes.Unattended;
                }
                else
                {
                    Console.WriteLine(
                        "The path to a script file '" +
                        args[0] +
                        "' is not valid.");
                }
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (mode == RunModes.Unattended)
            {
                var runnerForm = new UiaRunnerForm();
                TestRunner.InitScript();
                TestData.TmxNewTestResultClosed +=
                    new TmxStructureChangedEventHandler(
                        TestRunner.NewTestResultClosed);
                Runner.PSErrorThrown   += runnerForm.PSStateErrorThrown;
                Runner.PSOutputArrived += runnerForm.PSOutputArrived;
                TestRunner.RunScript(args[0], true);

                /*
                 * TestRunner.InitScript();
                 * TestData.TmxNewTestResultClosed +=
                 *  new Tmx.TmxStructureChangedEventHandler(
                 *      PSTestRunner.TestRunner.NewTestResultClosed);
                 * Runner.PSErrorThrown +=
                 *  new PSRunner.PSStateChangedEventHandler(
                 *      runnerForm.PSStateErrorThrown);
                 * Runner.PSOutputArrived +=
                 *  new PSRunner.PSDataArrivedEventHandler(
                 *      runnerForm.PSOutputArrived);
                 * TestRunner.RunScript(args[0], true);
                 */
            }
            else
            {
                Application.Run(new UiaRunnerForm());
            }
        }
Пример #2
0
 private static void Main(string[] args)
 {
     RunModes mode = RunModes.Gui;
     
     if (args == null || args.Length > 0) {
         if (System.IO.File.Exists(args[0])) {
             mode = RunModes.Unattended;
         } else {
             Console.WriteLine(
                 "The path to a script file '" + 
                 args[0] +
                 "' is not valid.");
         }
     }
     
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     
     if (mode == RunModes.Unattended) {
         var runnerForm = new UiaRunnerForm();
         TestRunner.InitScript();
         TestData.TmxNewTestResultClosed += 
             new TmxStructureChangedEventHandler(
             TestRunner.NewTestResultClosed);
         Runner.PSErrorThrown += runnerForm.PSStateErrorThrown;
         Runner.PSOutputArrived += runnerForm.PSOutputArrived;
         TestRunner.RunScript(args[0], true);
         
         /*
         TestRunner.InitScript();
         TestData.TmxNewTestResultClosed += 
             new Tmx.TmxStructureChangedEventHandler(
                 PSTestRunner.TestRunner.NewTestResultClosed);
         Runner.PSErrorThrown +=
             new PSRunner.PSStateChangedEventHandler(
                 runnerForm.PSStateErrorThrown);
         Runner.PSOutputArrived +=
             new PSRunner.PSDataArrivedEventHandler(
                 runnerForm.PSOutputArrived);
         TestRunner.RunScript(args[0], true);
         */
     } else {
         Application.Run(new UiaRunnerForm());
     }
 }