public void Dispatch_FunctionCallExprAndStringList_CorrectFunctionCallExprPassed() { FunctionCallExpression expected = new FunctionCallExpression("func", null, 0, 0); FunctionCallExpression input1 = expected; List <string> input2 = new List <string>() { "id" }; IReferenceHelper helper = Substitute.For <IReferenceHelper>(); ReferenceHandler refHandler = new ReferenceHandler(helper); FunctionCallExpression res = null; helper.VisitFunctionCall(Arg.Do <FunctionCallExpression>(x => res = x), Arg.Any <List <string> >()); refHandler.Dispatch(input1, input2); res.Should().BeEquivalentTo(expected); }
public void Dispatch(ExpressionNode node, List <string> parameters) { Try(() => { switch (node) { case IdentifierExpression e: _helper.VisitIdentifier(e, parameters); break; case INonIdentifierExpression e: _helper.VisitNonIdentifier(e, parameters); break; case FunctionCallExpression e: _helper.VisitFunctionCall(e, parameters); break; case SetExpression e: _helper.VisitSet(e, parameters); break; case AnonymousFunctionExpression e: _helper.VisitAnonymousFunction(e, parameters); break; default: throw new UnimplementedReferenceHandlerException(node); } }); }