Daniel Halan - 388 - Oct 26, 2014

Retrieving Service in UnitTesting, 
The use of ApiTestContext.AppHost.Container.Resolve<MyServices>(); to retrieve a Service doesn’t initiate the Response Property, which is Protected so mocking it afterwards is not possible. Is this correct behavior? 

You mean the Request Context? Yeah that’s only available at runtime (i.e. not from the IOC). You want to use the ResolveService&lt;T&gt; API’s which also injects the current Request Context, see:
http://stackoverflow.com/a/23809669/85785 

Depending on your test you can mock the Request Context with:
service.Request = new BasicRequest(dto); 

The RequestContext can also be used to execute services with: appHost.ExecuteService(requestDto, reqCtx);

Some examples at:
https://github.com/ServiceStack/ServiceStack/blob/master/tests/ServiceStack.Common.Tests/ManageRolesTests.cs

Daniel Halan:

Actually ‘Response’, as Request is a Public property its easy to assign it using Moq. What does the ‘AppHost.Container.Resolve<T>()’  initiate beside creating the Service Class? 

Nothing, that API literally just resolves the dependency from the IOC.

Daniel Halan:

Ok