public void TestGlobalSerializer()
        {
            var config = new SerializationConfig();

            config.ConfigureGlobalSerializer(gs =>
            {
                gs.TypeName = typeof(GlobalSerializer).AssemblyQualifiedName;
            });
            var ss  = new SerializationServiceBuilder().SetConfig(config).Build();
            var foo = new CustomSerializableType {
                Value = "fooooo"
            };

            var d      = ss.ToData(foo);
            var newFoo = ss.ToObject <CustomSerializableType>(d);

            Assert.AreEqual(newFoo.Value, foo.Value);
        }
        public virtual void TestCustomSerialize()
        {
            var config = new SerializationConfig();

            var sc = new SerializerConfig()
                     .SetImplementation(new CustomSerializer())
                     .SetTypeClass(typeof(CustomSerializableType));

            config.SerializerConfigs.Add(sc);
            var ss = new SerializationServiceBuilder().SetConfig(config).Build();

            var foo = new CustomSerializableType {
                Value = "fooooo"
            };

            var d      = ss.ToData(foo);
            var newFoo = ss.ToObject <CustomSerializableType>(d);

            Assert.AreEqual(newFoo.Value, foo.Value);
        }
        public void TestWriteObjectWithCustomSerializable()
        {
            var config = new SerializationConfig();
            var sc     = new SerializerConfig()
                         .SetImplementation(new CustomSerializer())
                         .SetTypeClass(typeof(CustomSerializableType));

            config.AddSerializerConfig(sc);
            var serializationService =
                new SerializationServiceBuilder().SetPortableVersion(1)
                .AddPortableFactory(TestSerializationConstants.PORTABLE_FACTORY_ID, new TestPortableFactory())
                .SetConfig(config).Build();

            var foo = new CustomSerializableType {
                Value = "foo"
            };

            var objectCarryingPortable1 = new ObjectCarryingPortable(foo);
            var data = serializationService.ToData(objectCarryingPortable1);
            var objectCarryingPortable2 = serializationService.ToObject <ObjectCarryingPortable>(data);

            Assert.AreEqual(objectCarryingPortable1, objectCarryingPortable2);
        }
 protected bool Equals(CustomSerializableType other)
 {
     return(string.Equals(Value, other.Value));
 }