示例#1
0
        public static TestInnerClass CreateMinimal()
        {
            TestInnerClass target = new TestInnerClass();

            target.InnerName = "innerName";
            return(target);
        }
示例#2
0
        public void ReadMembers()
        {
            TestInnerClass inner = new TestInnerClass();

            NetReflector.Read(@"<foo name=""foo"" />", inner);
            Assert.AreEqual("foo", inner.InnerName);
        }
示例#3
0
        public static TestInnerClass Create()
        {
            TestInnerClass target = CreateMinimal();

            target.Missing = "missing";
            target.Present = "present";
            return(target);
        }
示例#4
0
        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 void ReadMembers()
		{
			TestInnerClass inner = new TestInnerClass();
			NetReflector.Read(@"<foo name=""foo"" />", inner);
			Assert.AreEqual("foo", inner.InnerName);
		}
示例#6
0
 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;
		}
示例#9
0
 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);
 }
示例#10
0
        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);
        }
示例#11
0
        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));
        }
示例#12
0
        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));
        }