public static TestApplication RunWinApplication(this IApplicationAdapter adapter, string fileName, int port = 4100)
        {
            var testApplication = EasyTestWinApplication.New(fileName, port);

            adapter.RunApplication(testApplication, null);
            return(testApplication);
        }
        public static TestApplication RunWebApplication(this IApplicationAdapter adapter, string physicalPath, int port)
        {
            var testApplication = EasyTestWebApplication.New(physicalPath, port);

            adapter.RunApplication(testApplication);
            return(testApplication);
        }
        public static TestApplication RunWebApplication(this IApplicationAdapter adapter, string physicalPath, int port, string connectionString)
        {
            var testApplication = EasyTestWebApplication.New(physicalPath, port);

            testApplication.ConfigSettings(connectionString);
            adapter.RunApplication(testApplication, null);
            return(testApplication);
        }
        public static TestApplication RunWinApplication(this IApplicationAdapter winAdapter, string fileName,
                                                        int port = 4100)
        {
            var testApplication = new TestApplication();

            testApplication.AddAttribute("FileName", fileName);
            testApplication.AddAttribute("CommunicationPort", port.ToString());
            winAdapter.RunApplication(testApplication);
            return(testApplication);
        }
        public static TestApplication RunWinApplication(this IApplicationAdapter adapter, string fileName, string connectionString)
        {
            foreach (var file in Directory.GetFiles($"{Path.GetDirectoryName(fileName)}", "Model.User.xafml"))
            {
                File.Delete(file);
            }
            var testApplication = EasyTestWinApplication.New(fileName);

            testApplication.ConfigSettings(connectionString);
            adapter.RunApplication(testApplication, null);
            return(testApplication);
        }
        public static TestApplication RunWebApplication(this IApplicationAdapter winAdapter, string physicalPath,
                                                        string port)
        {
            var testApplication = new TestApplication();

            testApplication.AddAttribute("SingleWebDev", "true");
            testApplication.AddAttribute("DontRestartIIS", "true");
            testApplication.AddAttribute("UseIISExpress", "true");
            testApplication.AddAttribute("PhysicalPath", physicalPath);
            testApplication.AddAttribute("URL", $"http://localhost:{port}/default.aspx");
            winAdapter.RunApplication(testApplication);
            return(testApplication);
        }
        public static TestApplication RunBlazorApplication(this IApplicationAdapter adapter, string physicalPath, int port,
                                                           string connectionString)
        {
            var testApplication = EasyTestWebApplication.New(physicalPath, port, false);

            testApplication.Browser = "chrome";
            testApplication.ConfigSettings(connectionString);
            testApplication.AddAttribute("Configuration", "Debug");
            adapter.RunApplication(testApplication, "");

            // var browser = (IWebBrowser) new ChromeBrowser();
            // adapter.Driver.Navigate().GoToUrl($"https://localhost:{port}");
            // var serverResponseAwaiter = new BlazorAppResponseAwaiter().GetServerResponseAwaiter(adapter.Driver);
            // var wait = new WebDriverWait(adapter.Driver, TimeSpan.FromSeconds(30.0));
            // wait.Until(SeleniumUtils.ElementExists(By.ClassName("app")));
            // wait.Until(serverResponseAwaiter);
            return(testApplication);
        }
 private static void RunApplication(this IApplicationAdapter adapter, TestApplication testApplication)
 {
     adapter.RunApplication(testApplication, $"ConnectionString={InMemoryDataStoreProvider.ConnectionString}");
 }