You apparently do not use the latest version of Spring4D as this feature has been implemented last november (see the update in https://stackoverflow.com/a/11315141/587106)
Currently there is no auto mocking of the container but I like the idea and will look into implementing something that makes this easier (possibly by improving the container extension).
At the moment a test case method would look like this (using DSharp mocks syntax):
procedure TMyTestCase.TestSomething;
var
progressBarMock: Mock<IProgressBar>;
sut: TTestComponent;
begin
container.RegisterType<TTestComponent>;
container.RegisterType<IProgressBar>.DelegateTo(
function: IProgressBar
begin
Result := progressBarMock;
end);
container.Build;
// mock setup
sut := container.Resolve<TTestComponent>;
// perform test
end;
Anyway I highly suggest writing unit tests without the use of a DI container.
If your SUT has many dependencies making the use of the container appealing that is often a sign of violating certain design principles.