public void HasValue()
        {
            BindingEnvironment environment = new BindingEnvironment();

            environment.SetValue("foo", "bar");
            Assert.IsTrue(environment.HasValue("foo"));
            Assert.IsFalse(environment.HasValue("undefined"));
        }
        public void HasValue()
        {
            BindingEnvironment environment = new BindingEnvironment();

            environment.SetValue("foo", "bar");
            Assert.IsTrue(environment.HasValue("foo"));
            Assert.IsFalse(environment.HasValue("undefined"));
        }
Example #3
0
        public object Evaluate(BindingEnvironment environment)
        {
            object value = environment.GetValue(this.name);

            if (value != null)
            {
                return(value);
            }

            if (environment.HasValue(this.name))
            {
                return(value);
            }

            throw new InvalidOperationException(string.Format("NameError: name '{0}' not defined", this.name));
        }