I am trying to debug through my unit tests with visual studio but my breakpoints arent being hit - even though they are set correctly. I am definetly hitting the code - i have confirm by throw dummy exceptions and the debugger breaks into my source code at the right point.
Any ideas? I really need to be able to step through the code under test.
I have a small sample project to demonstrate this issue:
public interface ISearch2
{
string GetString(int type);
}
public interface IProvision
{
ISearch2 Search { get; }
}
public abstract class BaseClass2
{
protected string GetString(IProvision p, int type)
{
type++; // breakpoint set here not stopping debugger
return p.Search.GetString(type);
}
}
[TestClass]
public class UnitTest2
{
[TestMethod]
public void TestMethod1()
{
var mockInterface = Isolate.Fake.Instance<IProvision>();
Isolate.WhenCalled(() => mockInterface.Search.GetString(1)).WithExactArguments().WillReturn("one");
var mockBase = Isolate.Fake.Instance<BaseClass2>();
Isolate.NonPublic.WhenCalled(mockBase, "GetString").CallOriginal();
string s = Isolate.Invoke.Method(mockBase, "GetString", mockInterface, 0) as string;
Isolate.Verify.WasCalledWithExactArguments(() => mockInterface.Search.GetString(1));
Assert.IsNotNull(s);
Assert.AreEqual(s, "one");
}
}