Ejemplo n.º 1
0
        public void SerializeWellknown()
        {
            var order = new MainDataOne();

            order.Name = "Test";
            FlatProtoDataSerializer serializer = new FlatProtoDataSerializer(true, stream);
            var data        = serializer.Serialize(order);
            var orderResult = serializer.Deserialize <MainDataOne>(data);

            Assert.AreNotSame(order, orderResult);
            Assert.AreEqual(36, data.Length);
            Assert.AreEqual("Test", orderResult.Name);
        }
Ejemplo n.º 2
0
        public void SerializeObject()
        {
            var order = new MainDataOne();

            order.Name = "Test";
            var serializerTests = new FlatProtoDataSerializer(false, stream);
            var data            = serializerTests.Serialize <IMainData>(order);
            var orderResult     = (IMainData)serializerTests.Deserialize(typeof(IMainData), data);

            Assert.AreNotSame(order, orderResult);
            Assert.AreEqual(116, data.Length);
            Assert.AreEqual("Test", orderResult.Name);
        }