Adds test method to SharedCredential.

Also converts to as_xml/to_xml XML marshalling.