[英]Unable to debug unit test cases using fakes
我正在将单元测试项目与MS Fakes模拟框架一起使用
Visual Studio Premium 2013更新4
。 当我在Visual Studio中运行测试时,它工作正常,但是当我尝试调试单元测试用例时,它失败并显示以下错误:
Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationException:无法从COR_PROFILER_PATH和COR_PROFILER环境变量解析探查器路径。
我尝试过以下方法:
编辑:
[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);
}
}
有什么办法吗?
我已经添加了一些接口,我需要将其存根到伪造设置中。 例如:
<StubGeneration>
<Clear/>
<Add Interfaces="true" FullName="ISimpleHttpService"/>
</StubGeneration>
<ShimGeneration>
<Clear/>
<Add FullName="HttpResponse"/>
</ShimGeneration>
说明:我们只需要添加单元测试伪造品正在使用的那些伪造品dll。 并且我们需要将StubGeneration标签添加到xml文件中。 这些标签取决于单元测试用例所使用的类。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.