是否认为不好的做法使用InternalsVisibleTo单元测试code? [英] Is it considered bad practice to use InternalsVisibleTo for Unit Test Code?

查看:140
本文介绍了是否认为不好的做法使用InternalsVisibleTo单元测试code?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

样品code框架的的AssemblyInfo.cs

[assembly: System.Runtime.CompilerServices.InternalsVisibleTo
                          ("Test.Company.Department.Core")]

这是一个不好的做法?

推荐答案

没有,它不被视为不好的做法。有没有别的办法,如果你想测试这些类是内部的组件很好的理由。只是没有测试他们会差很多。

No, it is not considered bad practice. There is no other way, if the classes you want to test are internal to your assembly for good reasons. Just not testing them would be a lot worse.

这篇关于是否认为不好的做法使用InternalsVisibleTo单元测试code?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆