Example #1
0
        public void TestAddDataSerializableFactoryWithBadId()
        {
            var config = new SerializationConfig();

            config.AddDataSerializableFactory(-1, new MyDataSerializableFactory());
            var service = new SerializationServiceBuilder().SetConfig(config).Build();
        }
Example #2
0
        public void TestAddDataSerializableFactoryClassWithDuplicateId()
        {
            var config = new SerializationConfig();

            config.AddDataSerializableFactory(1, new MyDataSerializableFactory());
            config.AddDataSerializableFactoryClass(1, typeof(MyDataSerializableFactory));
            var service = new SerializationServiceBuilder().SetConfig(config).Build();
        }
Example #3
0
 public void TestAddDataSerializableFactoryWithBadId()
 {
     Assert.Throws <ArgumentException>(() =>
     {
         var config = new SerializationConfig();
         config.AddDataSerializableFactory(-1, new MyDataSerializableFactory());
         var service = new SerializationServiceBuilder().SetConfig(config).Build();
     });
 }
Example #4
0
 public void TestAddDataSerializableFactoryClassWithDuplicateId()
 {
     Assert.Throws <ArgumentException>(() =>
     {
         var config = new SerializationConfig();
         config.AddDataSerializableFactory(1, new MyDataSerializableFactory());
         config.AddDataSerializableFactoryClass(1, typeof(MyDataSerializableFactory));
         var service = new SerializationServiceBuilder().SetConfig(config).Build();
     });
 }
Example #5
0
        public void TestAddDataSerializableFactory()
        {
            var service1 = new SerializationServiceBuilder().Build();
            var data     = service1.ToData(new DataSerializableBasicType());

            var config = new SerializationConfig();

            config.AddDataSerializableFactory(1, new MyDataSerializableFactory());
            var service = new SerializationServiceBuilder().SetConfig(config).Build();

            var obj = service.ToObject <object>(data);

            Assert.IsInstanceOf <DataSerializableBasicType>(obj);
        }