예제 #1
0
        public void Execute(IBindingEnvironment environment)
        {
            IBindingEnvironment newenv = environment;

            if (this.localvar)
            {
                newenv = new LocalBindingEnvironment(environment);
                newenv.SetLocalValue(this.name, null);
            }

            foreach (object result in (IEnumerable)this.expression.Evaluate(newenv))
            {
                newenv.SetValue(this.name, result);
                this.command.Execute(newenv);
            }
        }
예제 #2
0
        public void Execute(IBindingEnvironment environment)
        {
            IBindingEnvironment newenv = environment;

            if (this.localvar)
            {
                newenv = new LocalBindingEnvironment(environment);
                newenv.SetLocalValue(this.name, null);
            }

            foreach (object result in (IEnumerable)this.expression.Evaluate(newenv))
            {
                newenv.SetValue(this.name, result);
                this.command.Execute(newenv);
            }
        }
        public void SetValueThruLocalAndNormalEnviroment()
        {
            BindingEnvironment      parent   = new BindingEnvironment();
            LocalBindingEnvironment toplocal = new LocalBindingEnvironment(parent);

            toplocal.SetLocalValue("one", 0);

            BindingEnvironment environment = new BindingEnvironment(toplocal);

            LocalBindingEnvironment local = new LocalBindingEnvironment(environment);

            local.SetValue("one", 1);

            Assert.AreEqual(1, local.GetValue("one"));
            Assert.AreEqual(1, environment.GetValue("one"));
            Assert.AreEqual(1, toplocal.GetValue("one"));
            Assert.IsNull(parent.GetValue("one"));
        }
예제 #4
0
        public void SetValueThruLocalAndNormalEnviroment()
        {
            BindingEnvironment parent = new BindingEnvironment();
            LocalBindingEnvironment toplocal = new LocalBindingEnvironment(parent);

            toplocal.SetLocalValue("one", 0);

            BindingEnvironment environment = new BindingEnvironment(toplocal);

            LocalBindingEnvironment local = new LocalBindingEnvironment(environment);
            local.SetValue("one", 1);

            Assert.AreEqual(1, local.GetValue("one"));
            Assert.AreEqual(1, environment.GetValue("one"));
            Assert.AreEqual(1, toplocal.GetValue("one"));
            Assert.IsNull(parent.GetValue("one"));
        }