public void TestRawDataInvaliRead() { var serializationService = CreateSerializationService(1, ByteOrder.BigEndian); var p = new InvalidRawDataPortable2(DateTime.Now.ToFileTime(), "test chars".ToCharArray(), new NamedPortable("named portable", 34567), 9876, "Testing raw portable", new ByteArrayDataSerializable(Encoding.UTF8.GetBytes("test bytes"))); var builder = new ClassDefinitionBuilder(p.GetFactoryId(), p.GetClassId()); builder.AddLongField("l").AddCharArrayField("c").AddPortableField("p", CreateNamedPortableClassDefinition()); serializationService.GetPortableContext().RegisterClassDefinition(builder.Build()); var data = serializationService.ToData(p); Assert.AreEqual(p, serializationService.ToObject <RawDataPortable>(data)); }
public void TestRawDataInvaliRead() { var serializationService = CreateSerializationService(1, ByteOrder.BigEndian); var p = new InvalidRawDataPortable2(DateTime.Now.ToFileTime(), "test chars".ToCharArray(), new NamedPortable("named portable", 34567), 9876, "Testing raw portable", new ByteArrayDataSerializable(Encoding.UTF8.GetBytes("test bytes"))); var builder = new ClassDefinitionBuilder(p.GetFactoryId(), p.GetClassId()); builder.AddLongField("l").AddCharArrayField("c").AddPortableField("p", CreateNamedPortableClassDefinition()); serializationService.GetPortableContext().RegisterClassDefinition(builder.Build()); var data = serializationService.ToData(p); Assert.AreEqual(p, serializationService.ToObject<RawDataPortable>(data)); }