示例#1
0
        public void MessageSerializer_when_given_payload_serializer_with_string_manifest_should_be_able_to_evolve_the_data_type()
        {
            var oldEvent    = new MyPayload("a");
            var serializer1 = _serialization.FindSerializerFor(oldEvent);
            var bytes       = serializer1.ToBinary(oldEvent);

            // now the system is updated to version 2 with new class MyPayload2
            // and MyPayload2Serializer that handles migration from old MyPayload
            var serializer2  = _serialization.FindSerializerForType(typeof(MyPayload2));
            var deserialized = serializer2.FromBinary(bytes, oldEvent.GetType());

            deserialized.ShouldBe(new MyPayload2(".a.", 0));
        }
示例#2
0
 protected bool Equals(MyPayload other)
 {
     return(string.Equals(Data, other.Data));
 }
示例#3
0
 protected bool Equals(MyPayload other)
 {
     return string.Equals(Data, other.Data);
 }
示例#4
0
        public void MessageSerializer_when_given_payload_serializer_with_string_manifest_should_be_able_to_evolve_the_data_type()
        {
            var oldEvent = new MyPayload("a");
            var serializer1 = _serialization.FindSerializerFor(oldEvent);
            var bytes = serializer1.ToBinary(oldEvent);

            // now the system is updated to version 2 with new class MyPayload2
            // and MyPayload2Serializer that handles migration from old MyPayload
            var serializer2 = _serialization.FindSerializerForType(typeof(MyPayload2));
            var deserialized = serializer2.FromBinary(bytes, oldEvent.GetType());

            deserialized.ShouldBe(new MyPayload2(".a.", 0));
        }