public void GetLargeStringInNodeMemento() { XmlDocument document = DataMother.GetXmlDocument("CDataTest.xml"); XmlNode node = document.DocumentElement.FirstChild; var memento = new XmlNodeInstanceMemento(node, "Type", "Key"); Assert.AreEqual("select * from table", memento.GetProperty("bigProp")); }
protected override InstanceMemento getChild(string Key) { InstanceMemento returnValue = null; XmlNode nodeChild = getChildNode(Key); if (nodeChild != null) { returnValue = new XmlNodeInstanceMemento(nodeChild, _typeAttribute, _keyAttribute); } return(returnValue); }
public void SetUp() { XmlDocument doc = DataMother.GetXmlDocument("XmlInstanceMemento.xml"); memento = new XmlNodeInstanceMemento(doc.DocumentElement, "Type", "Key"); }
protected override InstanceMemento getChild(string Key) { InstanceMemento returnValue = null; XmlNode nodeChild = getChildNode(Key); if (nodeChild != null) { returnValue = new XmlNodeInstanceMemento(nodeChild, _typeAttribute, _keyAttribute); } return returnValue; }
public void Read_in_a_dictionary_type_from_a_node_normalized_memento() { string xml = @" <root> <Property Name='dictionary'> <Pair Key='color' Value='red'/> <Pair Key='state' Value='texas'/> <Pair Key='direction' Value='north'/> </Property> </root> "; XmlElement element = DataMother.BuildDocument(xml).DocumentElement; element.SetAttribute("PluggedType", typeof (ClassWithDictionary).AssemblyQualifiedName); var memento = new XmlNodeInstanceMemento(element, "Type", "Key"); Instance instance = memento.ReadInstance(new PluginGraph(), typeof (ClassWithDictionary)); var theObject = (ClassWithDictionary) instance.Build(typeof (ClassWithDictionary), new BuildSession(new PluginGraph())); theObject.Dictionary["color"].ShouldEqual("red"); theObject.Dictionary["state"].ShouldEqual("texas"); theObject.Dictionary["direction"].ShouldEqual("north"); }