Is there any point Unit testing serialization?

后端 未结 13 926
慢半拍i
慢半拍i 2021-02-01 23:38

I have a class that serializes a set of objects (using XML serialization) that I want to unit test.

My problem is it feels like I will be testing the .NET implementation

13条回答
  •  余生分开走
    2021-02-02 00:19

    I have done this in some cases... not testing the serialisation as such, but using some 'known good' XML serializations and then loading them into my classes, and checking that all the properties (as applicable) have the expected values.

    This is not going to test anything for the first version... but if the classes ever evolve I know I will catch any breaking changes in the format.

提交回复
热议问题