예제 #1
0
        // ---------------- Functions ----------------

        // -------- Setup / Teardown --------

        public void PerformFixtureSetup(ChaskisFixtureConfig config = null)
        {
            Step.Run(
                this.testStateLog,
                "Running Fixture Setup",
                () => PerformFixtureSetupInternal(config)
                );
        }
예제 #2
0
        private void PerformFixtureSetupInternal(ChaskisFixtureConfig config)
        {
            if (config == null)
            {
                config = new ChaskisFixtureConfig();
            }

            if (this.logFile == null)
            {
                SetupLog();
            }

            // ---------------- Setup Environment ----------------

            if (config.Environment == null)
            {
                this.EnvironmentManager.SetupDefaultEnvironment(config.Port);
            }
            else
            {
                this.EnvironmentManager.SetupEnvironment(config.Environment, config.Port);
            }

            // ---------------- Start Server ----------------

            Step.Run(
                "Starting server",
                () => this.IrcServer.StartServer(config.Port)
                );

            // ---------------- Start Process ----------------

            Step.Run(
                "Starting Client",
                () =>
            {
                this.ProcessRunner = new ChaskisProcess(this.EnvironmentManager.ChaskisDistDir, this.EnvironmentManager.TestEnvironmentDir);
                this.ProcessRunner.StartProcess();
            }
                );

            // ---------------- Wait to join ----------------

            Step.Run(
                "Waiting for client to connect to server",
                () => this.IrcServer.WaitForConnection().FailIfFalse("Server never got IRC connection")
                );

            Step.Run(
                "Wait for client to finish connecting.",
                () =>
            {
                if (config.ConnectionWaitMode == ConnectionWaitMode.WaitForConnected)
                {
                    this.ProcessRunner.WaitForClientToConnect();
                }
                else if (config.ConnectionWaitMode == ConnectionWaitMode.WaitForFinishJoiningChannels)
                {
                    this.ProcessRunner.WaitToFinishJoiningChannels();
                }

                // Else, do nothing.
            }
                );
        }