public void CustomSerializerWithCustomPackformatName_Success() { var source = new MyTypeWithCustomPackName() { MyProperty = 42 }; var serializer = GetSerializer <MyTypeWithCustomPackName>(); var pack = serializer.Serialize(source); var jobj = JObject.Parse(pack); jobj[Constants.TypeNameKey].Value <string>().Should().Be("MyPackType"); jobj[Constants.VersionKey].Value <uint>().Should().Be(1); jobj["MyKey"].Value <int>().Should().Be(42); var target = serializer.Deserialize(pack); target.MyProperty.Should().Be(42); }
public static void Serializer(IShapeshifterWriter writer, MyTypeWithCustomPackName itemToSerialize) { writer.Write("MyKey", itemToSerialize.MyProperty); }