Exemple #1
0
 public ProjectStepDefinitionBinding(ScenarioBlock stepDefinitionType, Regex regex, ITagExpression scope, ProjectStepDefinitionImplementation implementation)
 {
     StepDefinitionType = stepDefinitionType;
     Regex          = regex;
     Scope          = scope;
     Implementation = implementation;
 }
Exemple #2
0
        public ProjectStepDefinitionBinding ImportStepDefinition(StepDefinition stepDefinition)
        {
            try
            {
                var stepDefinitionType = (ScenarioBlock)Enum.Parse(typeof(ScenarioBlock), stepDefinition.Type);
                var regex          = new Regex(stepDefinition.Regex, RegexOptions.CultureInvariant);
                var sourceLocation = ParseSourceLocation(stepDefinition.SourceLocation);
                var scope          = ParseScope(stepDefinition.Scope);
                var parameterTypes = ParseParameterTypes(stepDefinition.ParamTypes);

                if (!_implementations.TryGetValue(stepDefinition.Method, out var implementation))
                {
                    implementation = new ProjectStepDefinitionImplementation(stepDefinition.Method, parameterTypes, sourceLocation);
                    _implementations.Add(stepDefinition.Method, implementation);
                }


                return(new ProjectStepDefinitionBinding(stepDefinitionType, regex, scope, implementation));
            }
            catch (Exception ex)
            {
                _logger.LogWarning($"Invalid binding: {ex.Message}");
                return(null);
            }
        }
Exemple #3
0
 public ProjectStepDefinitionBinding(ScenarioBlock stepDefinitionType, Regex regex, Scope scope, ProjectStepDefinitionImplementation implementation, string expression = null, string error = null)
 {
     StepDefinitionType = stepDefinitionType;
     Regex          = regex;
     Scope          = scope;
     Implementation = implementation;
     Expression     = expression;
     Error          = error;
 }