public void EvaluateNameWithNull()
        {
            NameExpression expression = new NameExpression("foo");

            BindingEnvironment environment = new BindingEnvironment();

            environment.SetValue("foo", null);

            Assert.IsNull(expression.Evaluate(environment));
        }
        public void EvaluateNameExpression()
        {
            NameExpression expression = new NameExpression("foo");

            BindingEnvironment environment = new BindingEnvironment();

            environment.SetValue("foo", "bar");

            Assert.AreEqual("bar", expression.Evaluate(environment));
        }
        public void RaiseIfNameIsUndefined()
        {
            NameExpression expression = new NameExpression("foo");

            BindingEnvironment environment = new BindingEnvironment();

            try
            {
                expression.Evaluate(environment);
                Assert.Fail("Exception expected");
            }
            catch (Exception ex)
            {
                Assert.IsInstanceOfType(ex, typeof(NameError));
                Assert.AreEqual("name 'foo' is not defined", ex.Message);
            }
        }