public async Task ExecuteScenarioAsync(Feature featureInstance, string scenarioName) { if (featureInstance == null) { throw new ArgumentNullException(nameof(featureInstance)); } if (string.IsNullOrWhiteSpace(scenarioName)) { throw new ArgumentNullException(nameof(scenarioName)); } var featureClass = FeatureClass.FromFeatureInstance(featureInstance); var featureFile = _featureFileRepository.GetByFilePath(featureClass.FeatureFilePath); var gherkinScenario = featureFile.GetScenario(scenarioName); if (gherkinScenario == null) { throw new InvalidOperationException($"Cannot find scenario `{scenarioName}`."); } var scenario = featureClass.ExtractScenario(gherkinScenario); await scenario.ExecuteAsync(new ScenarioOutput(featureInstance.InternalOutput)); }
public async Task ExecuteScenarioAsync(Feature featureInstance, string scenarioName) { if (featureInstance == null) { throw new System.ArgumentNullException(nameof(featureInstance)); } if (string.IsNullOrWhiteSpace(scenarioName)) { throw new System.ArgumentNullException(nameof(scenarioName)); } var featureClass = FeatureClass.FromFeatureInstance(featureInstance); var featureFile = _featureFileRepository.GetByFilePath(featureClass.FeatureFilePath); var scenario = featureClass.ExtractScenario(scenarioName, featureFile); await scenario.ExecuteAsync(new ScenarioOutput(featureInstance.Output)); }
public async Task ExecuteScenarioOutlineAsync( Feature featureInstance, string scenarioOutlineName, string exampleName, int exampleRowIndex) { if (featureInstance == null) { throw new ArgumentNullException(nameof(featureInstance)); } if (string.IsNullOrWhiteSpace(scenarioOutlineName)) { throw new ArgumentNullException(nameof(scenarioOutlineName)); } if (exampleRowIndex < 0) { throw new ArgumentException($"`{nameof(exampleRowIndex)}` must be positive", nameof(exampleRowIndex)); } var featureClass = FeatureClass.FromFeatureInstance(featureInstance); var featureFile = _featureFileRepository.GetByFilePath(featureClass.FeatureFilePath); var gherkinScenarioOutline = featureFile.GetScenarioOutline(scenarioOutlineName); if (gherkinScenarioOutline == null) { throw new InvalidOperationException($"Cannot find scenario outline `{scenarioOutlineName}`."); } var gherkinScenario = gherkinScenarioOutline.ApplyExampleRow(exampleName, exampleRowIndex); var gherkinBackground = featureFile.GetBackground(); if (gherkinBackground != null) { gherkinScenario = gherkinScenario.ApplyBackground(gherkinBackground); } var scenario = featureClass.ExtractScenario(gherkinScenario); await scenario.ExecuteAsync(new ScenarioOutput(featureInstance.InternalOutput)); }