I have a public method, which calls private method, and it’s in a loop.
public void FileManipulator(StreamReader file)
{
string line;
while ((line = file.ReadLine()) != null)
{
if (checkLine(line))
{
//some logic
}
else
{
putToExceptions(line);
}
}
}
private void putToExceptions(string line)
{
//some logic
}
How can I verify the numbers of times this inner private method was called? I’ve tried to use Isolate.Verify.GetTimesCalled
, but it apparently doesn’t fit to private methods.
Disclaimer. I work in Typemock.
You're right, Isolate.Verify.GetTimesCalled() isn't available for non-public methods. You can count the number of method was called using Isolate.WhenCalled(..).DoInstead():
You can read more about NonPublic API here.