public static string GetXml(DateTime date) { return(GetXml(date, string.Format(@"<inner classType=""inner"">{0}</inner>", TestInnerClass.GetInnerXml()))); }
public void RaiseEventIfXmlContainsDuplicateNodes() { string xml = TestClass.GetXml(DateTime.Now, string.Format(@"<inner name=""dupe"">{0}<present>dupe</present></inner>", TestInnerClass.GetInnerXml())); table.InvalidNode += new InvalidNodeEventHandler(HandleUnusedNode); serialiser.Read(XmlUtil.ReadNode(xml), table); Assert.AreEqual(2, nodes.Count); Assert.AreEqual("name", InvalidNodeName(0)); Assert.AreEqual("present", InvalidNodeName(1)); }
public void DoNotRaiseEventIfXmlContainsComments() { string xml = TestClass.GetXml(DateTime.Now, string.Format(@"<inner>{0}<!-- foo --></inner>", TestInnerClass.GetInnerXml())); table.InvalidNode += new InvalidNodeEventHandler(HandleUnusedNode); serialiser.Read(XmlUtil.ReadNode(xml), table); Assert.AreEqual(0, nodes.Count); }
public void RaiseEventIfXmlContainsUnnecessaryNodes() { string xml = TestClass.GetXml(DateTime.Now, string.Format(@"<inner fooz=""bar""><baz/><yaz />{0}</inner>", TestInnerClass.GetInnerXml())); table.InvalidNode += new InvalidNodeEventHandler(HandleUnusedNode); serialiser.Read(XmlUtil.ReadNode(xml), table); Assert.AreEqual(3, nodes.Count); Assert.AreEqual("fooz", InvalidNodeName(0)); Assert.AreEqual("baz", InvalidNodeName(1)); Assert.AreEqual("yaz", InvalidNodeName(2)); }