In the below example code, there is a class that derives from other, and the derived one's constructor calls to its base's constructor. I couldn't find a way to make the base constructor call mocked. I want the code inside the derived constructor to execute, but the call to the base constructor to be mocked. Is this possible ?
To give more explantion, in the test code below, when
Mumbo m = new Mumbo("abc");
is executed, the constructor of Jumbo() is called, even though it is not called when
Jumbo j = new Jumbo("abc");
is executed, because Jumbo's constructor is talled to be mocked. I was expecting at the former call, the Jumbo's constructore to be mocked as well.
class Jumbo
{
private int abc;
private string s;
public Jumbo(string s)
{
this.s = s;
}
}
class Mumbo : Jumbo
{
public Mumbo(string s) : base(s)
{
}
}
[TestFixture]
public class Testa
{
[Test]
public void Test()
{
MockManager.Init();
Mock jMock = MockManager.Mock(typeof (Jumbo));
Mumbo m = new Mumbo("abc");
Jumbo j = new Jumbo("abc");
}
}