I have class that constructor calls a function in constructor. When I create mock for this class then function is called from constructor. I want to block function calling. Can I do it?
Sample code:
public class Foo
{
public Foo()
{
Initialize();
}
private void Initialize()
{
//some code
}
}
[TestFixture]
public class Test
{
[Test]
public void Test_Foo()
{
Foo foo = MockRepository.GenerateMock<Foo>();
//some test
}
}
Notes:
- I don't want to add interface, like
Foo : IFoo
. - I don't want to add second constructor.