Is it possible in Rhino.Mocks to verify whether a specified constructor was called?
Consider the following code:
public interface IFoo
{
void Bar();
}
public class FooFactory
{
public IFoo CreateInstance(int x, int y)
{
return new Foo(x, y);
}
}
public class Foo : IFoo
{
public Foo(int x, int y)
{
// ... blah
}
public void Bar()
{
// blah...
}
}
[TestFixture]
public class FooFactoryTest
{
[Test]
public void Assert_Foo_Ctor_Called_By_Factory_CreateInstance()
{
MockRepository mocks = new MockRepository();
using (mocks.Record())
{
Expect.Call( /* ???? */ );
}
using(mocks.Playback())
{
new FooFactory().CreateInstance(1, 2);
}
mocks.VerifyAll();
}
}
I would like to verify that Foo(int, int) was called by the FooFactory.