/// <summary> /// Executes the discovery command as specified in the configuration for the requested test source. /// </summary> /// <param name="source">The test source module</param> /// <returns>The test framework describing all tests contained within the test source or null if one cannot be provided.</returns> private TestFramework ExecuteExternalDiscoveryCommand(string source) { // Use a temporary file to host the result of the external discovery process string path = Path.Combine(Path.GetDirectoryName(source), Path.GetFileName(source) + ListFileSuffix); // Perform cleanup to avoid inconsistent listing if (File.Exists(path)) { File.Delete(path); } CommandEvaluator evaluator = new CommandEvaluator(); evaluator.SetVariable("source", source); evaluator.SetVariable("out", path); // Evaluate the discovery command CommandLine commandLine = new CommandLine { FileName = evaluator.Evaluate(this.Settings.DiscoveryCommandLine.FileName).Result, Arguments = evaluator.Evaluate(this.Settings.DiscoveryCommandLine.Arguments).Result }; // Execute the discovery command via an external process if (ExecuteCommand(commandLine)) { // Parse the generate TestFramework from the temporary file return ParseTestFramework(path); } return null; }
/// <summary> /// Provides a preset CommandEvaluator instance for evaluating strings containing the source placeholder. /// </summary> /// <param name="source">The source placeholder value</param> /// <returns>A CommandEvaluator instance for evaluating strings containing the source placeholder.</returns> private static CommandEvaluator BuildEvaluator(string source) { CommandEvaluator evaluator = new CommandEvaluator(); evaluator.SetVariable(SourcePlaceholder, source); return evaluator; }
public void SetUp() { CommandEvaluator = new CommandEvaluator(); }