Should you Unit Test simple properties?

前端 未结 8 1354
耶瑟儿~
耶瑟儿~ 2021-02-01 13:22

Should you Unit Test simple properties of a class, asserting that a value is set and retrieved? Or is that really just unit testing the language?

Example

8条回答
  •  不思量自难忘°
    2021-02-01 13:23

    Unless the properties perform any other sort of logic, then no.

    Yes, it is like unit testing the language. It would be completely pointless to test simple auto-implemented properties otherwise.

提交回复
热议问题