Isolate.NonPublic.WhenCalled Should't Call Public Method with the same name:
Here's the production code
public class MyObj
{
public void Generate()
{
try
{
Generate("hi");
}
catch
{
}
}
private void Generate(string name)
{
}
}
And here's the test code
[Test]
public void TestMyObj()
{
var myObj = new MyObj();
Isolate.NonPublic.WhenCalled(myObj , "Generate")
.WillThrow(new Exception("Dummy error"));
Assert.DoesNotThrow(()=>myObj.Generate());
}
This test should pass because the exception is thrown at private method level, and it is handled by the public Generate method. However, Typemock seems to confuse this and throws an exception when the public Generate method is called, resulting in the test fail.
________
Drug Testing