示例#1
0
        private IRunnerVariablesProvider GetVariablesProvider(FitVariables variables)
        {
            IRunnerVariablesProvider variablesProvider =
                Mock.Of <IRunnerVariablesProvider>(varProv =>
                                                   varProv.CreateRunnerVariables() == variables);

            return(variablesProvider);
        }
示例#2
0
        public void Should_Read_Symbols_From_JavaScript()
        {
            // Arrange.
            FitVariables initialVariables = new FitVariables();

            initialVariables.put("my_sym", "98");
            IRunnerVariablesProvider variablesProvider = GetVariablesProvider(initialVariables);
            RestResponse             response          = new RestResponse();
            JavascriptWrapper        jswrapper         = new JavascriptWrapper(variablesProvider);
            string expectedResult = "my sym is: 98";

            // Act.
            string javascriptText = "'my sym is: ' + symbols['my_sym']";
            object rawResult      = jswrapper.evaluateExpression(response, javascriptText);
            string actualResult   = rawResult.ToString();

            // Assert.
            Assert.AreEqual(expectedResult, actualResult);
        }