Using “friend”-declarations for unit testing. Bad idea?

前端 未结 5 1906
情书的邮戳
情书的邮戳 2020-12-30 02:28

[Of course, the question is not restricted to a specific \"friend\" implementation, feel free though to point out implementation specifics if relevant]

Read

5条回答
  •  情歌与酒
    2020-12-30 03:09

    It's the only use I've ever personally applied to InternalsVisibleTo - and it's been very, very handy indeed.

    I don't view unit tests as black box testing - they're already coupled to the implementation to some extent. Being able to test internal types and methods allows a much tighter focus (smaller units).

提交回复
热议问题