public void Xml_Build_ExecutesBuilderOnNewXml_ReturnsXml() { bool executed = false; Xml result = Xml.Build(x => { executed = true; x.hello("world"); }); Assert.True(executed); Assert.Equal("<hello>world</hello>", result); }
public XmlObjectElement Add(string name, object obj, XmlObject overrideObject, EventHandler <XmlObjectEventArgs> handler) { if (name == null) { name = Rnd.String(10, Collections.WordDigitUnderscore); } if (!Elements.ContainsKey(name)) { if (obj == null) { obj = new object(); } var build = Xml.Build(obj, XmlPrefix, typeCollections, handler, null, this, overrideObject); Elements.Add(name, build); return(build); } else { return(Elements[name]); } }
public void Xml_Build_NullBuilder_ThrowsNullException() { Assert.Throws <ArgumentNullException>(() => Xml.Build(null)); }