简体   繁体   English

C# 单元测试不单步执行代码

[英]C# Unit test does not step-into code

I am trying to write unit test for a C# implementation in Visual Studio 2013 with .Net 4.5.我正在尝试使用 .Net 4.5 在 Visual Studio 2013 中为 C# 实现编写单元测试。 This solution was created in VS2010 but now it is imported to VS 2013.此解决方案是在 VS2010 中创建的,但现在已导入到 VS 2013。

I have original code in assembly X and the unit tests in assembly Y. When I run unit tests from assembly Y then it does not execute the methods in assembly X and in the debug logs I can see following message.我在程序集 X 中有原始代码,在程序集 Y 中有单元测试。当我从程序集 Y 运行单元测试时,它不会执行程序集 X 中的方法,并且在调试日志中我可以看到以下消息。 -- Stepping over non-user code<\/em> --跳过非用户代码<\/em>

Any idea what I will be missing in the settings etc. ?知道我会在设置等中缺少什么吗?

"

被测试的方法返回IEnumerable,因此由于延迟加载而永远不会被调用。

There is also the possibility that the method in question is mocked.也有可能模拟所讨论的方法。 In my case the whole interface was mocked but I had not noticed that!就我而言,整个界面都被嘲笑了,但我没有注意到!

"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM