public void TriangleArray()
        {
            TriangleArrayClass a = new TriangleArrayClass()
            {
                Bytes = new string[2][]
            };

            a.Bytes[0] = new string[] { "1", "2" };
            a.Bytes[1] = new string[] { "1", "2", "3" };

            XmlDocument target = new XmlDocument();

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

            Assert.AreEqual(1, target.DocumentElement.ChildNodes.Count);

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

            Assert.AreEqual(a.Bytes.GetLength(0), b.Bytes.GetLength(0));
            for (int x = 0; x < a.Bytes.Length; x++)
            {
                for (int y = 0; y < a.Bytes[x].Length; y++)
                {
                    Assert.AreEqual(a.Bytes[x][y], b.Bytes[x][y]);
                }
            }
        }
예제 #2
0
        public void TriangleArray()
        {
            TriangleArrayClass a = new TriangleArrayClass()
            {
                Bytes = new string[2][]
            };

            a.Bytes[0] = new string[] { "1", "2" };
            a.Bytes[1] = new string[] { "1", "2", "3" };

            JObject target = new JObject();

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

            AssertChildren(3, target);

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

            Assert.AreEqual(a.Bytes.GetLength(0), b.Bytes.GetLength(0));
            for (int x = 0; x < a.Bytes.Length; x++)
            {
                for (int y = 0; y < a.Bytes[x].Length; y++)
                {
                    Assert.AreEqual(a.Bytes[x][y], b.Bytes[x][y]);
                }
            }
        }