Add unit tests for serialization