public void TestWriteObjectWithPortable()
        {
            var ss = new SerializationServiceBuilder()
                     .AddPortableFactory(TestSerializationConstants.PORTABLE_FACTORY_ID,
                                         new PortableFactoryFunc(i => new NamedPortableV2()))
                     .AddDataSerializableFactory(TestSerializationConstants.DATA_SERIALIZABLE_FACTORY_ID,
                                                 GetDataSerializableFactory())
                     .Build();

            var ss2 = new SerializationServiceBuilder()
                      .AddPortableFactory(TestSerializationConstants.PORTABLE_FACTORY_ID,
                                          new PortableFactoryFunc(i => new NamedPortable()))
                      .AddDataSerializableFactory(TestSerializationConstants.DATA_SERIALIZABLE_FACTORY_ID,
                                                  GetDataSerializableFactory())
                      .SetPortableVersion(5)
                      .Build();

            var o1 = new ComplexDataSerializable(new NamedPortableV2("test", 123),
                                                 new ByteArrayDataSerializable(new byte[3]), null);
            var data = ss.ToData(o1);

            object o2 = ss2.ToObject <ComplexDataSerializable>(data);

            Assert.AreEqual(o1, o2);
        }
        public void TestWriteObjectWithPortable()
        {
            var ss = new SerializationServiceBuilder()
                .AddPortableFactory(TestSerializationConstants.PORTABLE_FACTORY_ID,
                    new PortableFactoryFunc(i => new NamedPortableV2()))
                .AddDataSerializableFactory(TestSerializationConstants.DATA_SERIALIZABLE_FACTORY_ID,
                    GetDataSerializableFactory())
                .Build();

            var ss2 = new SerializationServiceBuilder()
                .AddPortableFactory(TestSerializationConstants.PORTABLE_FACTORY_ID,
                    new PortableFactoryFunc(i => new NamedPortable()))
                .AddDataSerializableFactory(TestSerializationConstants.DATA_SERIALIZABLE_FACTORY_ID,
                    GetDataSerializableFactory())
                .SetPortableVersion(5)
                .Build();

            var o1 = new ComplexDataSerializable(new NamedPortableV2("test", 123),
                new ByteArrayDataSerializable(new byte[3]), null);
            var data = ss.ToData(o1);

            object o2 = ss2.ToObject<ComplexDataSerializable>(data);
            Assert.AreEqual(o1, o2);
        }
 protected bool Equals(ComplexDataSerializable other)
 {
     return(Equals(ds, other.ds) && Equals(ds2, other.ds2) && Equals(portable, other.portable));
 }
 protected bool Equals(ComplexDataSerializable other)
 {
     return Equals(ds, other.ds) && Equals(ds2, other.ds2) && Equals(portable, other.portable);
 }