public static AppConfigurator TestableAppConfigurator()
        {
            var webApplication = new WebApplication(Substitute.For<IProjectLocation>(), 45123);
            var configurator = new AppConfigurator();
            configurator.WithJavaScriptExecutor(() => Substitute.For<IJavaScriptExecutor>());
            configurator.WithWebDriver(() => Substitute.For<IWebDriver>());

            configurator
                .ProjectToTest(webApplication)
                .WithWebServer(Substitute.For<IWebServer>())
                .UsingCamera(new NullCamera());

            return configurator;
        }
        public static void Run(WebApplication app, Action<IAppConfigurator> configure)
        {
            try
            {
                Action<IAppConfigurator> action = x =>
                {
                    x.ProjectToTest(app);

                    if (configure != null)
                        configure(x);
                };
                
               Host = New(action);
            }
            catch (Exception ex)
            {
                _log.Error("The Seleno Application exited abnormally with an exception", ex);
            }
        }
        private static ProcessStartInfo ProcessStartInfo(WebApplication application)
        {
            // todo: grab stdout and/or stderr for logging purposes?
            var key = Environment.Is64BitOperatingSystem ? "programfiles(x86)" : "programfiles";
            var programfiles = Environment.GetEnvironmentVariable(key);

            var startInfo = new ProcessStartInfo
            {
                WindowStyle = ProcessWindowStyle.Normal,
                ErrorDialog = true,
                LoadUserProfile = true,
                CreateNoWindow = false,
                UseShellExecute = false,
                Arguments = String.Format("/path:\"{0}\" /port:{1}", application.Location.FullPath, application.PortNumber),
                FileName = string.Format("{0}\\IIS Express\\iisexpress.exe", programfiles)
            };

            foreach (var variable in application.EnvironmentVariables)
                startInfo.EnvironmentVariables.Add(variable.Key, variable.Value);

            return startInfo;
        }
 public IisExpressWebServer(WebApplication application)
 {
     if (application == null)
         throw new AppConfigurationException("The web application must be set.");
     _application = application;
 }
 public void ProjectToTest(WebApplication webApplication)
 {
     _webApplication = webApplication;
 }
 public IAppConfigurator ProjectToTest(WebApplication webApplication)
 {
     WebApplication = webApplication;
     return this;
 }
 public static void Run(string webProjectFolder, int portNumber, Action<IAppConfigurator> configure = null)
 {
     var webApplication = new WebApplication(ProjectLocation.FromFolder(webProjectFolder), portNumber);
     Run(webApplication, configure);
 }
 public IisExpressWebServer(WebApplication application)
 {
     _application = application;
 }