Adding Unit Tests for XmlFormatters with DeclaredType as object.

Issue #1072 
this doesn't test the difference between declaredType and runtimeType, which is what this bug is about