Ejemplo n.º 1
0
        public void Evaluate_OneWordSimpleExpression_ReturnsValueFromStack()
        {
            var applicationContext = Substitute.For<IApplicationContext>();
            applicationContext.Dal.Returns(Substitute.For<IDal>());
            var valueStack = new ValueStack.Stack.ValueStack(Substitute.For<IExceptionHandler>()
                , Substitute.For<IExpressionContext>(), applicationContext);
            
            applicationContext.Dal.TranslateString("$value").Returns("$value");

            valueStack.Values.Add("value", 42);

            object actual = valueStack.Evaluate("$value");

            Assert.AreEqual(42, actual);
        }
Ejemplo n.º 2
0
        public void Evaluate_OneWordSimpleExpression_ReturnsValueFromStack()
        {
            var applicationContext = Substitute.For <IApplicationContext>();

            applicationContext.Dal.Returns(Substitute.For <IDal>());
            var valueStack = new ValueStack.Stack.ValueStack(Substitute.For <IExceptionHandler>()
                                                             , Substitute.For <IExpressionContext>(), applicationContext);

            applicationContext.Dal.TranslateString("$value").Returns("$value");

            valueStack.Values.Add("value", 42);

            object actual = valueStack.Evaluate("$value");

            Assert.AreEqual(42, actual);
        }