Exemple #1
0
        object CallVariable(String expression)
        {
            String            varName = expression.Substring(1);
            IExternalFunction func    = Values["controller"] as IExternalFunction;

            return(func.CallVariable(varName));
        }
Exemple #2
0
        private static Evaluator CreateEvaluator(Dictionary <string, object> values = null, IExternalFunction controller = null, Dictionary <string, string> translations = null)
        {
            var valueStack = Substitute.For <IValueStack>();

            if (values != null)
            {
                valueStack.Values.Returns(values);
            }

            var translator = Substitute.For <ITranslator>();

            if (translations != null)
            {
                translator.TranslateByKey(Arg.Any <string>()).Returns(info => translations[info.Arg <string>()]);
            }

            var evaluator = new Evaluator(valueStack, translator);

            evaluator.SetController(controller ?? Substitute.For <IExternalFunction>());
            return(evaluator);
        }
Exemple #3
0
        private static Evaluator CreateEvaluator(Dictionary<string, object> values = null, IExternalFunction controller = null, Dictionary<string, string> translations = null)
        {
            var valueStack = Substitute.For<IValueStack>();
            if (values != null)
                valueStack.Values.Returns(values);

            var translator = Substitute.For<ITranslator>();
            if (translations != null)
                translator.TranslateByKey(Arg.Any<string>()).Returns(info => translations[info.Arg<string>()]);

            var evaluator = new Evaluator(valueStack, translator);
            evaluator.SetController(controller ?? Substitute.For<IExternalFunction>());
            return evaluator;
        }
Exemple #4
0
        public object CallScript(String functionName, object[] parameters)
        {
            IExternalFunction func = Values["controller"] as IExternalFunction;

            return(func.CallFunction(functionName, parameters));
        }
Exemple #5
0
            public CollocatedExternalFunction(IExternalFunction/*!*/externalFunction, IExternals extManager)
            {
                Debug.Assert(externalFunction != null);

                this.externalFunction = externalFunction;
                this.extManager = extManager;
            }
Exemple #6
0
 public void SetController(IExternalFunction controller)
 {
     _executor.SetController(controller);
 }
Exemple #7
0
 public void SetController(IExternalFunction controller)
 {
     _controller = controller;
 }
Exemple #8
0
 public void SetController(IExternalFunction controller)
 {
     _executor.SetController(controller);
 }