Hi
Of course it is possible! 8)
In reflective mocks it is straight forward just like
you will do with public methods.
class TheClass
{
public int Method()
{
return PrivateMethod();
}
private int PrivateMethod()
{
return 1;
}
}
[TestFixture]
public class TestClass
{
[Test]
public void Test()
{
Mock mock = MockManager.Mock(typeof(TheClass));
mock.ExpectAndReturn("PrivateMethod", 5);
TheClass c = new TheClass();
Assert.AreEqual(5, c.Method());
}
}
You can mock private methods using natural mocks if you are using
Visual Studio Team System.
See the details
here