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

            LocalBindingEnvironment local  = new LocalBindingEnvironment(environment);
            LocalBindingEnvironment local2 = new LocalBindingEnvironment(local);

            local2.SetValue("one", 1);

            Assert.AreEqual(1, local.GetValue("one"));
            Assert.AreEqual(1, local2.GetValue("one"));
            Assert.AreEqual(1, environment.GetValue("one"));
        }
        public void SetValueThruLocalEnviroment()
        {
            BindingEnvironment environment = new BindingEnvironment();

            environment.SetValue("one", 0);

            LocalBindingEnvironment local = new LocalBindingEnvironment(environment);

            local.SetValue("one", 1);

            Assert.AreEqual(1, local.GetValue("one"));
            Assert.AreEqual(1, environment.GetValue("one"));
        }
示例#3
0
        public void DefineAndSetGlobalValueThruLocalEnvironment()
        {
            Machine machine = new Machine();
            BindingEnvironment environment = new BindingEnvironment();
            LocalBindingEnvironment local = new LocalBindingEnvironment(environment);

            local.DefineGlobal("global");

            local.SetValue("global", 100);

            Assert.AreEqual(100, local.GetValue("global"));
            Assert.AreEqual(100, environment.GetValue("global"));
            Assert.AreEqual(100, machine.Environment.GetValue("global"));
        }
        public void DefineAndSetGlobalValueThruLocalEnvironment()
        {
            Machine                 machine     = new Machine();
            BindingEnvironment      environment = new BindingEnvironment();
            LocalBindingEnvironment local       = new LocalBindingEnvironment(environment);

            local.DefineGlobal("global");

            local.SetValue("global", 100);

            Assert.AreEqual(100, local.GetValue("global"));
            Assert.AreEqual(100, environment.GetValue("global"));
            Assert.AreEqual(100, machine.Environment.GetValue("global"));
        }
        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"));
        }
示例#6
0
        public void SetValueThruLocalEnviroment()
        {
            BindingEnvironment environment = new BindingEnvironment();
            environment.SetValue("one", 0);

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

            Assert.AreEqual(1, local.GetValue("one"));
            Assert.AreEqual(1, environment.GetValue("one"));
        }
示例#7
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"));
        }
示例#8
0
        public void SetUndefinedValueUsingTwoLocalEnviroments()
        {
            BindingEnvironment environment = new BindingEnvironment();

            LocalBindingEnvironment local = new LocalBindingEnvironment(environment);
            LocalBindingEnvironment local2 = new LocalBindingEnvironment(local);

            local2.SetValue("one", 1);

            Assert.AreEqual(1, local.GetValue("one"));
            Assert.AreEqual(1, local2.GetValue("one"));
            Assert.AreEqual(1, environment.GetValue("one"));
        }