Exemple #1
0
 public void TestScope()
 {
     Assert.AreEqual("world", model.get("hello"));
     model.pushScope();
     model.put("hello", "new world");
     Assert.AreEqual("new world", model.get("hello"));
     model.popScope();
     Assert.AreEqual("world", model.get("hello"));
 }
Exemple #2
0
        public void Test()
        {
            var defaults = new Dictionary<string, object>();
            defaults.Add("hello", "world");

            model = new JadeModel(defaults);
            model.put("new", true);

            Assert.IsFalse(defaults.ContainsKey("new"));
            Assert.IsTrue(model.ContainsKey("new"));
            Assert.AreEqual(model.get("hello"), "world");
        }
Exemple #3
0
        public void Test()
        {
            var defaults = new Dictionary <string, object>();

            defaults.Add("hello", "world");

            model = new JadeModel(defaults);
            model.put("new", true);

            Assert.IsFalse(defaults.ContainsKey("new"));
            Assert.IsTrue(model.ContainsKey("new"));
            Assert.AreEqual(model.get("hello"), "world");
        }
Exemple #4
0
        protected Dictionary<String, Object> mergeInheritedAttributes(JadeModel model)
        {
            Dictionary<String, Object> mergedAttributes = this.attributes;

            if (inheritsAttributes)
            {
                Object o = model.get("attributes");
                if (o != null && o is Dictionary<String, Object>) {
                    Dictionary<String, Object> inheritedAttributes = (Dictionary<String, Object>)o;

                    foreach (var entry in inheritedAttributes)
                    {
                        addAttribute(mergedAttributes, (String)entry.Key, entry.Value);
                    }
                }
            }
            return mergedAttributes;
        }
Exemple #5
0
        protected Dictionary <String, Object> mergeInheritedAttributes(JadeModel model)
        {
            Dictionary <String, Object> mergedAttributes = this.attributes;

            if (inheritsAttributes)
            {
                Object o = model.get("attributes");
                if (o != null && o is Dictionary <String, Object> )
                {
                    Dictionary <String, Object> inheritedAttributes = (Dictionary <String, Object>)o;

                    foreach (var entry in inheritedAttributes)
                    {
                        addAttribute(mergedAttributes, (String)entry.Key, entry.Value);
                    }
                }
            }
            return(mergedAttributes);
        }