Add base classes to test Serializers and Deserializers

Allows to avoid code duplication and to write more easily unit tests