示例#1
0
        public void TestNullStringEncodeDecode2()
        {
            var objectDataOutput = _serializationService.CreateObjectDataOutput(256);

            objectDataOutput.WriteString(null);
            var bytes           = objectDataOutput.ToByteArray();
            var objectDataInput = _serializationService.CreateObjectDataInput(bytes);
            var decodedStr      = objectDataInput.ReadString();

            Assert.IsNull(decodedStr);
        }
 public virtual void Before()
 {
     service1 = (SerializationService) new SerializationServiceBuilder()
         .AddPortableFactory(TestSerializationConstants.PORTABLE_FACTORY_ID, new PortableFactoryFunc(
             i => new MorphingBasePortable())).Build();
     service2 = (SerializationService) new SerializationServiceBuilder()
         .AddPortableFactory(TestSerializationConstants.PORTABLE_FACTORY_ID,
             new PortableFactoryFunc(
                 i => new MorphingPortable())).Build();
     var data = service1.ToData(new MorphingBasePortable(unchecked(1), true, (char) 2, 3, 4, 5, 1f, 2d, "test"));
     var input = service2.CreateObjectDataInput(data);
     var portableSerializer = service2.GetPortableSerializer();
     reader = portableSerializer.CreateMorphingReader(input);
 }
        public virtual void Before()
        {
            service1 = (SerializationService) new SerializationServiceBuilder(new NullLoggerFactory())
                       .AddPortableFactory(SerializationTestsConstants.PORTABLE_FACTORY_ID, new PortableFactoryFunc(
                                               i => new MorphingPortableBase())).Build();
            service2 = (SerializationService) new SerializationServiceBuilder(new NullLoggerFactory())
                       .AddPortableFactory(SerializationTestsConstants.PORTABLE_FACTORY_ID,
                                           new PortableFactoryFunc(
                                               i => new MorphingPortable())).Build();
            var data  = service1.ToData(new MorphingPortableBase(unchecked (1), true, (char)2, 3, 4, 5, 1f, 2d, "test"));
            var input = service2.CreateObjectDataInput(data);
            var portableSerializer = service2.PortableSerializer;

            reader = portableSerializer.CreateMorphingReader(input);
        }