public void SerializeSet()
        {
            SerializeSetClass a = new SerializeSetClass("test__", "test1");

            a.B = "test2";

            XmlDocument target = new XmlDocument();

            Serializer.Serialize((SystemXmlAdapter)target, a);

            Assert.AreEqual(0, target.DocumentElement.ChildNodes.Count);
            Assert.IsEmpty(target.DocumentElement.GetAttribute("A"));
            Assert.AreEqual("test2", target.DocumentElement.GetAttribute("B"));
            Assert.AreEqual("test1", target.DocumentElement.GetAttribute("c"));

            SerializeSetClass b = Deserializer.Deserialize <SerializeSetClass>((SystemXmlAdapter)target);

            Assert.AreEqual(a.A, b.A);
            Assert.AreEqual(a.B, b.B);
            Assert.AreEqual(a.c, b.c);
        }
Exemple #2
0
        public void SerializeSet()
        {
            SerializeSetClass a = new SerializeSetClass("test__", "test1");

            a.B = "test2";

            JObject target = new JObject();

            Serializer.Serialize((NewtonsoftJsonAdapter)target, a);

            AssertChildren(3, target);
            AssertNoAttribute("A", target);
            AssertAttribute("test2", "B", target);
            AssertAttribute("test1", "c", target);

            SerializeSetClass b = Deserializer.Deserialize <SerializeSetClass>((NewtonsoftJsonAdapter)target);

            Assert.AreEqual(a.A, b.A);
            Assert.AreEqual(a.B, b.B);
            Assert.AreEqual(a.c, b.c);
        }