Inheritance: IWebApplicationRunner
Ejemplo n.º 1
0
        public override bool Execute(OpenInput input)
        {
            input.CreateMissingSpecFolder();

            var reset = new ManualResetEvent(false);

            using (var runner = new WebApplicationRunner(input))
            {
                runner.Start();
                Console.WriteLine("Launching the browser to " + runner.BaseAddress);

                ProcessLauncher.GotoUrl(runner.BaseAddress);

#if NET46
                AppDomain.CurrentDomain.DomainUnload += (sender, args) =>
                {
                    runner.SafeDispose();
                };
#else
                System.Runtime.Loader.AssemblyLoadContext.Default.Unloading += context => runner.Dispose();
#endif

                Console.CancelKeyPress += (s, e) =>
                {
                    Console.WriteLine("Shutdown detected, tearing down the testing harness...");
                    runner.SafeDispose();
                    reset.Set();
                };

                tellUsersWhatToDo(runner.BaseAddress);
                reset.WaitOne();
            }

            return(true);
        }
Ejemplo n.º 2
0
        public override bool Execute(OpenInput input)
        {
            input.CreateMissingSpecFolder();

            var reset = new ManualResetEvent(false);

            using (var runner = new WebApplicationRunner(input))
            {
                runner.Start();
                Console.WriteLine("Launching the browser to " + runner.BaseAddress);

                Process.Start(runner.BaseAddress);

                AppDomain.CurrentDomain.DomainUnload += (sender, args) =>
                {
                    runner.SafeDispose();
                };

                Console.CancelKeyPress += (s, e) =>
                {
                    Console.WriteLine("Shutdown detected, tearing down the testing harness...");
                    reset.Set();
                };

                tellUsersWhatToDo();
                reset.WaitOne();
            }

            return(true);
        }