Example #1
0
        public void SetAndGetValueInParentEnvironment()
        {
            ValueEnvironment parent      = new ValueEnvironment();
            ValueEnvironment environment = new ValueEnvironment(parent);

            parent.SetValue("foo", "bar");
            environment.SetValue("foo", "newbar");
            Assert.AreEqual("newbar", environment.GetValue("foo"));
            Assert.AreEqual("newbar", parent.GetValue("foo"));

            Assert.IsTrue(parent.ContainsValue("foo"));
            Assert.IsFalse(environment.ContainsValue("foo"));

            Assert.IsTrue(parent.ContainsValue("Foo"));
            Assert.IsFalse(environment.ContainsValue("Foo"));
        }
Example #2
0
        public void ExecuteLocalCommand()
        {
            ICommand command = new LocalCommand(new string[] { "foo" });

            ValueEnvironment parent   = new ValueEnvironment();
            ValueEnvironment localenv = new ValueEnvironment(parent, ValueEnvironmentType.Local);
            ValueEnvironment childenv = new ValueEnvironment(localenv);

            command.Execute(null, childenv);

            Assert.IsFalse(childenv.ContainsValue("foo"));
            Assert.IsFalse(parent.ContainsValue("foo"));
            Assert.IsTrue(localenv.ContainsValue("foo"));
        }
Example #3
0
        public void ExecutePrivateCommand()
        {
            ICommand command = new PrivateCommand(new string[] { "foo" });

            ValueEnvironment parent     = new ValueEnvironment(ValueEnvironmentType.Public);
            ValueEnvironment privateenv = new ValueEnvironment(parent);
            ValueEnvironment localenv   = new ValueEnvironment(privateenv, ValueEnvironmentType.Local);

            command.Execute(null, localenv);

            Assert.IsFalse(localenv.ContainsValue("foo"));
            Assert.IsFalse(parent.ContainsValue("foo"));
            Assert.IsTrue(privateenv.ContainsValue("foo"));
        }