Exemplo n.º 1
0
        static void GoBackTest <T>(ref T original)
        {
            var typeRegistry = new Osaru.Serialization.TypeRegistry();
            var msgPack      = typeRegistry.SerializeToMessagePack(original);
            var d            = typeRegistry.GetDeserializer <T>();
            var parsed       = MessagePackParser.Parse(msgPack);
            var copy         = default(T);

            d.Deserialize(parsed, ref copy);

            Assert.AreEqual(original, copy);
        }
Exemplo n.º 2
0
        public void array129()
        {
            var typeRegistry = new Osaru.Serialization.TypeRegistry();
            var i128         = Enumerable.Range(0, 128).ToArray();
            var i129         = Enumerable.Range(0, 129).ToArray();
            var bytes128     = typeRegistry.SerializeToMessagePack(i128);
            var bytes129     = typeRegistry.SerializeToMessagePack(i129);
            var deserialized = default(int[]);

            typeRegistry.Deserialize(MessagePackParser.Parse(bytes128), ref deserialized);

            Assert.AreEqual(i128, deserialized);
        }