public void SerializeDeserializeComplexType() { var serializer = new StringKeySerializer(); var valueSerializer = new MessagePackValueSerializer(); var value = new MyClass { PropBool = true, PropString = "Hello コンニチハ!", FieldA = 123456, Inner = new MyClass.MyStruct { Value = Guid.NewGuid() } }; var serializeDirectly = Convert.ToBase64String(MessagePack.LZ4MessagePackSerializer.Serialize(value, MessagePack.Resolvers.ContractlessStandardResolver.Instance)); var deserializeDirectly = MessagePack.LZ4MessagePackSerializer.Deserialize <MyClass>(Convert.FromBase64String(serializeDirectly), MessagePack.Resolvers.ContractlessStandardResolver.Instance); var serialized = serializer.SerializeAsKey(valueSerializer, value); Assert.NotNull(serialized); Assert.Equal(serializeDirectly, serialized); var deserialized = serializer.DeserializeFromKey <MyClass>(valueSerializer, serialized); Assert.Equal(value.PropString, deserialized.PropString); Assert.Equal(value.PropBool, deserialized.PropBool); Assert.Equal(value.FieldA, deserialized.FieldA); Assert.Equal(value.Inner.Value, deserialized.Inner.Value); }
public void DeserializeEnum() { var serializer = new StringKeySerializer(); Assert.Equal(MyEnum.B, serializer.DeserializeFromKey <MyEnum>(null, "5678")); }
public TKey GetKey(IKumoDictionaryValueSerializer serializer, StringKeySerializer keySerializer) { return(keySerializer.DeserializeFromKey <TKey>(serializer, RowKey)); }