simplify random unit test by extracting common serialization methods
simplify random unit test by extracting common serialization methods

Summary:
Random test will randomly pick a method and run it, then compare the result between struct with lazy deserialization enabled vs disabled, to see whether behavior is changed when enabling lazy deserialization.

This diff extracted serialization operation so that code can be shared between Compact/Binary Protocol.

Reviewed By: vitaut

Differential Revision: D29436170

fbshipit-source-id: adf17023078b7deb7b694fc3142696f8196aee1c

facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift