private void CaptureConfiguration(IConfiguration configuration, IFileSystem fileSystem) { configuration.FeatureFolder = fileSystem.DirectoryInfo.FromDirectoryName(this.FeatureDirectory); configuration.OutputFolder = fileSystem.DirectoryInfo.FromDirectoryName(this.OutputDirectory); if (!string.IsNullOrEmpty(this.Language)) { configuration.Language = this.Language; } if (!string.IsNullOrEmpty(this.ResultsFormat)) { configuration.TestResultsFormat = (TestResultsFormat)Enum.Parse(typeof(TestResultsFormat), this.ResultsFormat, true); } if (!string.IsNullOrEmpty(this.ResultsFile)) { configuration.AddTestResultFiles( PathExtensions.GetAllFilesFromPathAndFileNameWithOptionalSemicolonsAndWildCards(this.ResultsFile, fileSystem)); } if (!string.IsNullOrEmpty(this.SystemUnderTestName)) { configuration.SystemUnderTestName = this.SystemUnderTestName; } if (!string.IsNullOrEmpty(this.SystemUnderTestVersion)) { configuration.SystemUnderTestVersion = this.SystemUnderTestVersion; } if (!string.IsNullOrEmpty(this.DocumentationFormat)) { configuration.DocumentationFormat = (DocumentationFormat)Enum.Parse(typeof(DocumentationFormat), this.DocumentationFormat, true); } if (!string.IsNullOrEmpty(this.ExcludeTags)) { configuration.ExcludeTags = this.ExcludeTags; } bool shouldEnableExperimentalFeatures; if (bool.TryParse(this.IncludeExperimentalFeatures, out shouldEnableExperimentalFeatures)) { if (shouldEnableExperimentalFeatures) { configuration.EnableExperimentalFeatures(); } } bool shouldEnableComments; if (bool.TryParse(this.EnableComments, out shouldEnableComments)) { if (!shouldEnableComments) { configuration.DisableComments(); } } }
public bool Parse(string[] args, IConfiguration 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; }
public bool Parse(string[] args, IConfiguration configuration, TextWriter stdout) { var currentDirectory = new DirectoryInfo(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 = 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.AddTestResultFiles( PathExtensions.GetAllFilesFromPathAndFileNameWithOptionalSemicolonsAndWildCards(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); } if (this.includeExperimentalFeatures) { configuration.EnableExperimentalFeatures(); } if (!string.IsNullOrEmpty(this.excludeTags)) { configuration.ExcludeTags = this.excludeTags; } if (!string.IsNullOrEmpty(this.hideTags)) { configuration.HideTags = this.hideTags; } bool enableComments; if (bool.TryParse(this.enableCommentsValue, out enableComments) && enableComments == false) { configuration.DisableComments(); } if (!string.IsNullOrEmpty(this.resourceDirectory)) { configuration.ResourceDirectory = resourceDirectory; } return(true); }
public bool Parse(string[] args, IConfiguration 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); } if (this.includeExperimentalFeatures) { configuration.EnableExperimentalFeatures(); } bool enableComments; if (bool.TryParse(this.enableCommentsValue, out enableComments) && enableComments == false) { configuration.DisableComments(); } return(true); }