我想在我的项目中使用Pex和Moles。我想使用Pex测试私有方法。
有没有人用Pex来测试私有方法?
如果我们不能直接测试,有没有办法测试私有方法?
发布于 2012-02-04 20:17:25
Pex的作者之一Peli:PEX will not work for private and protected methods和workaround pex internal class回答了这个问题。
以下是一些替代方案:
不要为了增加testability.
[assembly: InternalsVisibleTo("Company.Product.ProjectUnderTest.Tests")]放入Company.Product.ProjectUnderTest\Properties\AssemblyInfo.cs.testing .net
https://stackoverflow.com/questions/8613263
复制相似问题