FuncTest.Helpers.TestWebApplication.Deploy C# (CSharp) Method

Deploy() private method

The deploy.
private Deploy ( bool enableWin32Mode = false ) : void
enableWin32Mode bool The enable Win 32 Mode.
return void
        internal void Deploy(bool enableWin32Mode = false)
        {
            try
            {
                this.Pool = new IisApplicationPool(this.PoolName, enable32BitAppOnWin64: enableWin32Mode);
                this.WebSite = new IisWebSite(this.WebSiteName, this.AppFolder, this.Port, this.Pool);
                this.ExternalCall = string.Format("http://localhost:{0}/ExternalCalls.aspx", this.Port);
                this.IsFirstTest = true;
                if (Directory.Exists(this.AppFolder))
                    ACLTools.GetEveryoneAccessToPath(this.AppFolder);
            }
            catch (Exception ex)
            {
                Trace.TraceError("Exception occured while attempting to deploy application {0}: {1}. Tests will not continue as they are guaranteed to fail.", this.AppName, ex);
                throw ex;
            }
        }

Usage Example

示例#1
0
        /// <summary>
        /// Deploy all test applications and prepera infra.
        /// </summary>
        public static void Initialize()
        {
            if (!isInitialized)
            {
                lock (lockObj)
                {
                    if (!isInitialized)
                    {
                        Aspx451TestWebApplication = new TestWebApplication
                        {
                            AppName       = "Aspx451",
                            Port          = Aspx451Port,
                            IsRedFieldApp = false
                        };

                        Aspx451TestWebApplicationWin32 = new TestWebApplication
                        {
                            AppName       = "Aspx451Win32",
                            Port          = Aspx451PortWin32,
                            IsRedFieldApp = false
                        };

                        // this makes all traces have a timestamp so it's easier to troubleshoot timing issues
                        // looking for the better approach...
                        foreach (TraceListener listener in Trace.Listeners)
                        {
                            listener.TraceOutputOptions |= TraceOptions.DateTime;
                        }

                        SdkEventListener = new HttpListenerObservable(Aspx451FakeDataPlatformEndpoint);

                        EtwSession = new EtwEventSessionRdd();
                        EtwSession.Start();

                        Aspx451TestWebApplication.Deploy();
                        Aspx451TestWebApplicationWin32.Deploy(true);

                        if (RegistryCheck.IsNet46Installed)
                        {
                            Trace.TraceInformation("Detected DotNet46 as installed. Will check StatusMonitor status to determine expected prefix");

                            if (RegistryCheck.IsStatusMonitorInstalled)
                            {
                                Trace.TraceInformation("Detected Status Monitor as installed, ExpectedPrefix: rddp");
                                ExpectedSDKPrefix = "rddp";
                            }
                            else
                            {
                                Trace.TraceInformation("Detected Status Monitor as not installed, ExpectedPrefix: rddf");
                                ExpectedSDKPrefix = "rddf";
                            }
                        }
                        else
                        {
                            Trace.TraceInformation("Detected DotNet46 as not installed. Will install StatusMonitor if not already installed.");
                            Trace.TraceInformation("Tests against StatusMonitor instrumentation.");
                            ExpectedSDKPrefix = "rddp";

                            if (!RegistryCheck.IsStatusMonitorInstalled)
                            {
                                Trace.TraceInformation("StatusMonitor not already installed.Installing from:" + ExecutionEnvironment.InstallerPath);
                                Installer.SetInternalUI(InstallUIOptions.Silent);
                                string installerPath = ExecutionEnvironment.InstallerPath;
                                try
                                {
                                    Installer.InstallProduct(installerPath, "ACTION=INSTALL ALLUSERS=1 MSIINSTALLPERUSER=1");
                                    Trace.TraceInformation("StatusMonitor installed without errors.");
                                }
                                catch (Exception ex)
                                {
                                    Trace.TraceError(
                                        "Agent installer not found. Agent is required for running tests for framework version below 4.6" +
                                        ex);
                                    throw;
                                }
                            }
                            else
                            {
                                Trace.TraceInformation("StatusMonitor already installed.");
                            }
                        }

                        Trace.TraceInformation("IIS Restart begin.");
                        Iis.Reset();
                        Trace.TraceInformation("IIS Restart end.");

                        isInitialized = true;
                    }
                }
            }
        }
All Usage Examples Of FuncTest.Helpers.TestWebApplication::Deploy