Ejemplo n.º 1
0
        public void ExecuteVarCommandWithNullExpression()
        {
            VarCommand command = new VarCommand("foo", null);

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

            command.Execute(local2);

            Assert.IsTrue(local2.ContainsName("foo"));
            Assert.IsFalse(local.ContainsName("foo"));
            Assert.IsFalse(environment.ContainsName("foo"));

            Assert.IsNull(local2.GetValue("foo"));
        }
Ejemplo n.º 2
0
        public void ExecuteVarCommand()
        {
            VarCommand command = new VarCommand("foo", new ConstantExpression(10));

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

            command.Execute(local2);

            Assert.IsTrue(local2.ContainsName("foo"));
            Assert.IsFalse(local.ContainsName("foo"));
            Assert.IsFalse(environment.ContainsName("foo"));

            Assert.AreEqual(10, local2.GetValue("foo"));
        }