I'd like to mock a dependent method of the method I wish to test. How can I accomplish this using Moq?
public class ClassA : IClassA
{
public bool Method1(string entityType, string entityIdString)
{
int entityId;
if (!Int32.TryParse(entityIdString, out entityId))
{
return false;
}
return this.Method2() && _agent.Id == entityId;
}
public bool Method2() { ... }
}
How do I mock the sibling Method2() in my unit test?
This article didn't help me, because there is no inheritence in my target class. http://www.codenutz.com/unit-testing-mocking-base-class-methods-with-moq/