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")); }
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"); }
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"); }
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; }
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); }