Пример #1
0
        public void DispatchInteger_FunctionCallAndObjectList_CorrectFunctionCallExprPassed()
        {
            FunctionCallExpression expected = new FunctionCallExpression("", null, 0, 0);
            FunctionCallExpression input1   = expected;
            List <Object>          input2   = new List <Object>()
            {
                23, 2.334, null
            };
            IGenericHelper         ihelper     = Substitute.For <IGenericHelper>();
            Interpreter            interpreter = Utilities.GetIntepreterOnlyWith(ihelper);
            FunctionCallExpression res         = null;

            ihelper.FunctionCall <int>(Arg.Do <FunctionCallExpression>(x => res = x), Arg.Any <List <Object> >());

            interpreter.DispatchInt(input1, input2);

            res.Should().BeEquivalentTo(expected);
        }
        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);
        }