I am using unit test project along with MS Fakes mocking framework within
Visual Studio Premium 2013 Update 4
. It works fine when I run my tests within visual studio, but when I try to debug unit test cases it fails with below error:
Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationException: Failed to resolve profiler path from COR_PROFILER_PATH and COR_PROFILER environment variables.
Following methods I have tried:
Edit:
[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);
}
}
Any solutions?
I have added Interfaces which i need stub into settings of fakes. For example:
<StubGeneration>
<Clear/>
<Add Interfaces="true" FullName="ISimpleHttpService"/>
</StubGeneration>
<ShimGeneration>
<Clear/>
<Add FullName="HttpResponse"/>
</ShimGeneration>
Explanation: We need to add only those fakes dll which are being used by unit test fakes. And We need to add StubGeneration tags to xml file. These tags depends on the classes which are using by unit test cases.