[英]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.