Unit test for xml serialization + refactoring