public void ReferenceTypeSerializeBinaryTest477378791() { using (var ms = new ValueStream()) { var objs = new List <object>(); objs.Add(new Uri("http://localhost")); objs.Add(new Rectangle(0, 0, 100, 100)); // BinaryTree<int> btree = new BinaryTree<int>(); // btree.AddRange(1, 2, 3, 4, 5, 6); // objs.Add(btree); // SerializerTool.BinarySerialize(objs, ms); SerializerTool.Serialize(objs, ms, BinaryFormatter); ms.Position = 0; Console.WriteLine("Original Objects = " + ArrayTool.AsString(objs.ToArray())); Console.WriteLine("Binary Serialized =\r\n" + ms.GetHexDumpString()); ms.Position = 0; // List<object> objs2 = (List<object>)SerializerTool.BinaryDeserialize(ms); var objs2 = SerializerTool.Deserialize <List <object> >(ms, BinaryFormatter); Console.WriteLine("Deserialized = " + ArrayTool.AsString(objs2.ToArray())); for (int i = 0; i < objs.Count; i++) { Assert.AreEqual(objs[i], objs2[i]); } } }
public void ValueTypeSerializeBinaryTest1776368509() { using (var ms = new ValueStream()) { var strs = new[] { "가", "나", "다", "라" }; SerializerTool.Serialize(strs, ms, BinaryFormatter); // SerializerTool.BinarySerialize(strs, ms); ms.Position = 0; Console.WriteLine("Original Strings = " + ArrayTool.AsString(strs)); Console.WriteLine("Binary Serialized =\r\n" + ms.GetHexDumpString()); ms.Position = 0; // string[] strs2 = (string[])SerializerTool.BinaryDeserialize(ms); var strs2 = SerializerTool.Deserialize <string[]>(ms, BinaryFormatter); log.Debug("Deserialized = " + ArrayTool.AsString(strs2)); Assert.AreEqual(strs, strs2); } }