What I wanted to know was: what is the new recommended way to setup an instance to be resolved by the Resolver of the MockHttpRequest during testing? (in my case, setup a ICacheClient just for testing purposes)
Understood.
In these tests, we not testing an AppHost. We dont (currently) need to initialize it.
We are testing a bit of code that takes the current IRequest and does stuff with it, that’s why we were using the MockHttpRequest object.
So, now I need to construct a real instance of a IRequest to behave the way we wanted it to, i.e. use a specific ICacheClient instance.
(cant use Moq to create a Mock instance in this test).
var container = new Container();
container.Register(cacheClient);
Service.GlobalResolver = new BasicResolver(container);
var request = new MockHttpRequest
{
Dto = new MyDto()
};
It works. Just checking for maintainability in future.