开发者

How to test Framework if Unit tests are in separate assembly?

I have assembly with my framework and assembly with tests. But I need to test internal classes or substitute some services. For example, - I need to test internal helper. - My framework read and analyze files created by other application. I create these files manually for tests. But I can't give it to my framework from separ开发者_StackOverflow中文版ate assembly. I need to create mock for internal service to provide these files.


If You want Your internal classes to be visible to your tests You must make your test assembly a friend of your framework assembly.

You have to add

[assembly: InternalsVisibleTo("MyTestAssembly")]

in your framework assembly.

Here is a link to MSDN Documentation about friend assemblies - http://bit.ly/FriendAssemblies

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜