public void SquareArray() { SquareArrayClass a = new SquareArrayClass() { Bytes = new string[, ] { { "1", "2" }, { "3", "4" } }, }; XmlDocument target = new XmlDocument(); Serializer.Serialize((SystemXmlAdapter)target, a); Assert.AreEqual(1, target.DocumentElement.ChildNodes.Count); SquareArrayClass b = Deserializer.Deserialize <SquareArrayClass>((SystemXmlAdapter)target); Assert.AreEqual(a.Bytes.GetLength(0), b.Bytes.GetLength(0)); for (int x = 0; x < a.Bytes.GetLength(0); x++) { for (int y = 0; y < a.Bytes.GetLength(1); y++) { Assert.AreEqual(a.Bytes[x, y], b.Bytes[x, y]); } } }
public void SquareArray() { SquareArrayClass a = new SquareArrayClass { Bytes = new string[, ] { { "1", "2" }, { "3", "4" } }, }; JObject target = new JObject(); Serializer.Serialize((NewtonsoftJsonAdapter)target, a); AssertChildren(3, target); SquareArrayClass b = Deserializer.Deserialize <SquareArrayClass>((NewtonsoftJsonAdapter)target); Assert.AreEqual(a.Bytes.GetLength(0), b.Bytes.GetLength(0)); for (int x = 0; x < a.Bytes.GetLength(0); x++) { for (int y = 0; y < a.Bytes.GetLength(1); y++) { Assert.AreEqual(a.Bytes[x, y], b.Bytes[x, y]); } } }