Наследование: IConfiguration
        public bool Parse(string[] args, Configuration configuration, TextWriter stdout)
        {
            configuration.FeatureFolder = new DirectoryInfo(Directory.GetCurrentDirectory());
            configuration.OutputFolder = new DirectoryInfo(Environment.GetEnvironmentVariable("TEMP"));

            List<string> extra = this.options.Parse(args);

            if (this.versionRequested)
            {
                this.DisplayVersion(stdout);
                return false;
            }
            else if (this.helpRequested)
            {
                this.DisplayHelp(stdout);
                return false;
            }

            if (!string.IsNullOrEmpty(this.featureDirectory))
                configuration.FeatureFolder = new DirectoryInfo(this.featureDirectory);
            if (!string.IsNullOrEmpty(this.outputDirectory)) configuration.OutputFolder = new DirectoryInfo(this.outputDirectory);
            if (!string.IsNullOrEmpty(this.testResultsFormat))
                configuration.TestResultsFormat =
                    (TestResultsFormat) Enum.Parse(typeof (TestResultsFormat), this.testResultsFormat, true);
            if (!string.IsNullOrEmpty(this.testResultsFile)) configuration.TestResultsFile = new FileInfo(this.testResultsFile);
            if (!string.IsNullOrEmpty(this.systemUnderTestName)) configuration.SystemUnderTestName = this.systemUnderTestName;
            if (!string.IsNullOrEmpty(this.systemUnderTestVersion))
                configuration.SystemUnderTestVersion = this.systemUnderTestVersion;
            if (!string.IsNullOrEmpty(this.language)) configuration.Language = this.language;
            if (!string.IsNullOrEmpty(this.documentationFormat))
                configuration.DocumentationFormat =
                    (DocumentationFormat) Enum.Parse(typeof (DocumentationFormat), this.documentationFormat, true);

            return true;
        }
Пример #2
0
        private static void ApplyTestResultsToFeatures(IContainer container, Configuration configuration, GeneralTree<INode> features)
        {
            var testResults = container.Resolve<ITestResults>();

            var actionVisitor = new ActionVisitor<INode>(node =>
            {
                var featureTreeNode = node as FeatureNode;
                if (featureTreeNode == null)
                {
                    return;
                }

                if (configuration.HasTestResults)
                {
                    SetResultsAtFeatureLevel(featureTreeNode, testResults);
                    SetResultsForIndividualScenariosUnderFeature(featureTreeNode, testResults);
                }
                else
                {
                    featureTreeNode.Feature.Result = TestResult.Inconclusive;
                }
            });

            features.AcceptVisitor(actionVisitor);
        }
Пример #3
0
        public void ReportOn(Configuration configuration, Action<string> writeToLog)
        {
            writeToLog("Generating documentation based on the following parameters");
            writeToLog("----------------------------------------------------------");
            writeToLog($"Feature Directory         : {configuration.FeatureFolder.FullName}");
            writeToLog($"Output Directory          : {configuration.OutputFolder.FullName}");
            writeToLog($"Project Name              : {configuration.SystemUnderTestName}");
            writeToLog($"Project Version           : {configuration.SystemUnderTestVersion}");
            writeToLog($"Language                  : {configuration.Language}");
            writeToLog($"Incorporate Test Results? : {(configuration.HasTestResults ? "Yes" : "No")}");

            if (configuration.HasTestResults)
            {
                writeToLog($"Test Result Format        : {configuration.TestResultsFormat}");
                writeToLog($"Test Result File          : {configuration.TestResultsFile.FullName}");
            }
        }
Пример #4
0
 public LanguageServices(Configuration configuration)
     : this(configuration.Language)
 {
 }
Пример #5
0
        public bool Parse(string[] args, Configuration configuration, TextWriter stdout)
        {
            var currentDirectory =
                this.fileSystem.DirectoryInfo.FromDirectoryName(this.fileSystem.Directory.GetCurrentDirectory());
            configuration.FeatureFolder = currentDirectory;
            configuration.OutputFolder = currentDirectory;

            this.options.Parse(args);

            if (this.versionRequested)
            {
                this.DisplayVersion(stdout);
                return false;
            }
            else if (this.helpRequested)
            {
                this.DisplayHelp(stdout);
                return false;
            }

            if (!string.IsNullOrEmpty(this.featureDirectory))
            {
                configuration.FeatureFolder = this.fileSystem.DirectoryInfo.FromDirectoryName(this.featureDirectory);
            }

            if (!string.IsNullOrEmpty(this.outputDirectory))
            {
                configuration.OutputFolder = this.fileSystem.DirectoryInfo.FromDirectoryName(this.outputDirectory);
            }

            if (!string.IsNullOrEmpty(this.testResultsFormat))
            {
                configuration.TestResultsFormat =
                    (TestResultsFormat)Enum.Parse(typeof(TestResultsFormat), this.testResultsFormat, true);
            }

            if (!string.IsNullOrEmpty(this.testResultsFile))
            {
                var files = this.testResultsFile.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

                configuration.AddTestResultFiles(files.Select(f => this.fileSystem.FileInfo.FromFileName(f)));
            }

            if (!string.IsNullOrEmpty(this.systemUnderTestName))
            {
                configuration.SystemUnderTestName = this.systemUnderTestName;
            }

            if (!string.IsNullOrEmpty(this.systemUnderTestVersion))
            {
                configuration.SystemUnderTestVersion = this.systemUnderTestVersion;
            }

            if (!string.IsNullOrEmpty(this.language))
            {
                configuration.Language = this.language;
            }

            if (!string.IsNullOrEmpty(this.documentationFormat))
            {
                configuration.DocumentationFormat =
                    (DocumentationFormat)Enum.Parse(typeof(DocumentationFormat), this.documentationFormat, true);
            }

            return true;
        }