I have a class
public interface IMyInterface
{
string MethodA();
void MethodB();
}
public class MyClass : IMyInterface
{
public string MethodA()
{
// Do something important
}
public void MethodB()
{
string value = MethodA();
// Do something important
}
}
I want to unit test MethodB, but I'm having trouble thinking about how I can Mock MethodA
while still calling into MethodB
using Moq. Moq mocks the interface, not the class, so I can't just call mock.Object.MethodB()
, right?
Is this possible? If so, how?