public static TestInnerClass CreateMinimal() { TestInnerClass target = new TestInnerClass(); target.InnerName = "innerName"; return(target); }
public void ReadMembers() { TestInnerClass inner = new TestInnerClass(); NetReflector.Read(@"<foo name=""foo"" />", inner); Assert.AreEqual("foo", inner.InnerName); }
public static TestInnerClass Create() { TestInnerClass target = CreateMinimal(); target.Missing = "missing"; target.Present = "present"; return(target); }
public static TestClass Create(DateTime date) { TestClass target = new TestClass(); target.Count = 54; target.DateTime = date; target.InnerClass = TestInnerClass.Create(); target.Field = "field"; target.Message = "message"; target.Name = "foo"; return(target); }
public static string GetXml(DateTime date) { return(GetXml(date, string.Format(@"<inner classType=""inner"">{0}</inner>", TestInnerClass.GetInnerXml()))); }
public static void AssertEquals(TestInnerClass expected, TestInnerClass actual) { Assert.AreEqual(expected.InnerName, actual.InnerName); Assert.AreEqual(expected.Missing, actual.Missing); Assert.AreEqual(expected.Present, actual.Present); }
public static TestInnerClass CreateMinimal() { TestInnerClass target = new TestInnerClass(); target.InnerName = "innerName"; return target; }
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 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 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)); }