Esempio n. 1
0
 public ProjectStepDefinitionBinding(ScenarioBlock stepDefinitionType, Regex regex, ITagExpression scope, ProjectStepDefinitionImplementation implementation)
 {
     StepDefinitionType = stepDefinitionType;
     Regex          = regex;
     Scope          = scope;
     Implementation = implementation;
 }
        private void PushExpr(string token, Stack <ITagExpression> stack)
        {
            switch (token)
            {
            case "and":
                ITagExpression rightAndExpr = Pop(stack);
                stack.Push(new And(Pop(stack), rightAndExpr));
                break;

            case "or":
                ITagExpression rightOrExpr = Pop(stack);
                stack.Push(new Or(Pop(stack), rightOrExpr));
                break;

            case "not":
                stack.Push(new Not(Pop(stack)));
                break;

            default:
                stack.Push(new Literal(token));
                break;
            }
        }
Esempio n. 3
0
 public static bool EvaluateWithDefault(this ITagExpression tagExpression, IEnumerable <string> tags, bool defaultValue)
 {
     return(tagExpression?.Evaluate(tags) ?? defaultValue);
 }
Esempio n. 4
0
 public static bool EvaluateWithDefault(this ITagExpression tagExpression, IEnumerable <Tag> tags, bool defaultValue)
 {
     return(tagExpression?.Evaluate(tags.Select(t => t.Name)) ?? defaultValue);
 }
 public Not(ITagExpression expr)
 {
     this.expr = expr;
 }
 public And(ITagExpression left, ITagExpression right)
 {
     this.left  = left;
     this.right = right;
 }
        protected ProjectStepDefinitionBinding CreateStepDefinitionBinding(string regex, ScenarioBlock scenarioBlock = ScenarioBlock.Given, ITagExpression scope = null, string[] parameterTypes = null, string methodName = null)
        {
            methodName = methodName ?? ("MyMethod" + Guid.NewGuid().ToString("N"));
            if (!Implementations.TryGetValue(methodName, out var implementation))
            {
                implementation = new ProjectStepDefinitionImplementation(methodName, parameterTypes, new SourceLocation("MyClass.cs", 2, 5));
                Implementations.Add(methodName, implementation);
            }

            return(new ProjectStepDefinitionBinding(scenarioBlock, new Regex("^" + regex + "$"), scope, implementation));
        }