How to unit test if my object is really serializable?

后端 未结 7 1217
情书的邮戳
情书的邮戳 2020-12-03 00:45

I am using C# 2.0 with Nunit Test. I have some object that needs to be serialized. These objects are quite complex (inheritance at different levels and contains a lot of obj

7条回答
  •  情话喂你
    2020-12-03 01:21

    In addition to the test above - which makes sure the serializer will accept your object, you need to do a round-trip test. Deserialize the results back to a new object and make sure the two instances are equivalent.

提交回复
热议问题