コード例 #1
0
        public async Task StopSystem()
        {
            TestingLogger logger = new TestingLogger();

            if (this.ScenarioContext.TestError != null)
            {
                List <IContainerService> containers = this.TestingContext.DockerHelper.Containers.Where(c => c.Name == this.TestingContext.DockerHelper.EstateManagementContainerName).ToList();

                // The test has failed, grab the logs from all the containers
                foreach (IContainerService containerService in containers)
                {
                    ConsoleStream <String> logStream = containerService.Logs();
                    IList <String>         logData   = logStream.ReadToEnd();

                    foreach (String s in logData)
                    {
                        logger.LogInformation(s);
                    }
                }
            }

            String scenarioName = this.ScenarioContext.ScenarioInfo.Title.Replace(" ", "");

            logger.LogInformation($"About to Stop Containers for Scenario Run - {scenarioName}");
            await this.TestingContext.DockerHelper.StopContainersForScenarioRun().ConfigureAwait(false);

            logger.LogInformation($"Containers for Scenario Run Stopped  - {scenarioName}");
        }