I finally solved this using a custom written AutoMocker and ServiceLocator.
public class RecordPlaybackRhinoAutoMocker<TARGETCLASS> : AutoMocker<TARGETCLASS> where TARGETCLASS : class
{
private RecordPlaybackMocksServiceLocator MockRepository
{
get
{
return _serviceLocator as RecordPlaybackMocksServiceLocator;
}
}
public RecordPlaybackRhinoAutoMocker()
{
_serviceLocator = new RecordPlaybackMocksServiceLocator();
_container = new AutoMockedContainer(_serviceLocator);
}
public IDisposable Record()
{
return MockRepository.Record();
}
public IDisposable Playback()
{
return MockRepository.Playback();
}
}
public class RecordPlaybackMocksServiceLocator : StructureMap.AutoMocking.ServiceLocator
{
private readonly MockRepository _mocks;
public RecordPlaybackMocksServiceLocator()
{
_mocks = new MockRepository();
}
public T PartialMock<T>(params object[] args) where T : class
{
return _mocks.PartialMock<T>(args);
}
public object Service(Type serviceType)
{
return _mocks.StrictMock(serviceType);
}
public T Service<T>() where T : class
{
return _mocks.StrictMock<T>();
}
public IDisposable Record()
{
return _mocks.Record();
}
public IDisposable Playback()
{
return _mocks.Playback();
}
}
I still don't know if there is a built in way to do this. But this works and saves me from rewritting 1200 tests.