【发布时间】:2015-10-06 07:12:35
【问题描述】:
我在
中使用单元测试项目以及 MS Fakes 模拟框架Visual Studio Premium 2013 更新 4
。当我在 Visual Studio 中运行测试时它工作正常,但是当我尝试调试单元测试用例时它失败并出现以下错误:
Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationException: 无法从 COR_PROFILER_PATH 解析探查器路径和 COR_PROFILER 环境变量。
我尝试过的以下方法:
- 特定版本为 false [未工作]
- 删除所有假货、清理、构建和读取 [未工作]
- 添加了 System and mscorlib fakes [Not working]
编辑:
[TestMethod]
public void LoginResponseTest()
{
using (ShimsContext.Create())//Getting error here in case of debug test
{
var stub = new StubISimpleHttpService();
stub.SendPostRequestStringParameterCollection = GetLoginResponse;
MyAPIConnector connector = new MyAPIConnector();
uint response = connector.login("test_username", "test_password");
Assert.IsTrue(response == 0);
}
}
有什么解决办法吗?
【问题讨论】:
-
我怀疑是否有人能够根据这篇文章的知识重现此错误。请提供MCVE。
-
你是如何调试测试的?您是否使用任何第三方工具,例如 Jetbrains Resharper 测试运行器?在我厌倦了使用 Resharper 调试包含 MS Fakes 的单元测试之前,我已经看到过这个错误。
-
否,VS3013提供的默认单元测试
-
出于好奇,尝试以管理员身份运行 Visual Studio,然后尝试调试测试?这有什么区别吗?
标签: c# unit-testing visual-studio-2013 microsoft-fakes