Home  >  Q&A  >  body text

c++ - 如何在Visual studio 15中自带的单元测试框架中使用友元类?

大家讲道理大家讲道理2764 days ago574

reply all(1)I'll reply

  • ringa_lee

    ringa_lee2017-04-17 13:09:31

    Of course you can do it. However, if you do this, the unit test will depend on the implementation of your class instead of the interface, thus failing to achieve test as a specification and test driven development. purpose. In the future, although the function and interface of your class will not change, the implementation will change, and the last function of unit testregression test will be lost. Then why do you still write unit test?

    It is recommended that the subject read "xUnit Test Pattern" (do not read the Chinese version). Although it is not C++, it is consistent in spirit.

    reply
    0
  • Cancelreply