예제 #1
0
        public override bool Execute(OpenInput input)
        {
            input.CreateMissingSpecFolder();

            var reset = new ManualResetEvent(false);


            using (var app = new ApplicationController(input, input.BuildEngine(), new WebApplicationRunner(input)))
            {
                app.Start();

                Console.WriteLine("Launching the browser to " + app.Website.BaseAddress);

                ProcessLauncher.GotoUrl(app.Website.BaseAddress);

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

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

                tellUsersWhatToDo(app.Website.BaseAddress);
                reset.WaitOne();
            }


            return(true);
        }