I am using the protobuf-net library for serialization/deserialization of messages.
Due to the distributed nature of the application some applications will have an older version of the object that is being used to serialize messages. The cases I'm concerned with are
adding new fields to the message object that some consumers(deserializers) won't have
removing fields in the message object that some consumers(deserializers) will still have.
Example an old app has this definition of Foo
class Foo
{
public int Field1 {get; set;}
}
A newer app has this definition of Foo
class Foo
{
public int Field1 {get; set;}
public int Field2 {get; set;}
}
I want to have a test to verify that the library can deserialize an object with missing fields and fields that it isn't aware of in case I ever need to change my serialization library.
Is there an easy way to unit test this? C# won't let the user change the fields availabe in an object.
Currently I have to build my reciever app and then change the object that is transported to add a new field and then build my sending app to test this.
Is there a better way?