Per the documentation, I have written unit tests for my services as:
_appHost = new BasicAppHost().Init();
var container = _appHost.Container;
container.RegisterAutoWired<MyService>();
MyService service = _appHost.Container.Resolve<MyService>();
this works fine generally, however, one of my APIs calls GetSession().UserName to get the username of the current authenticated user so that I know who is using the API and can return him appropriate data. When I execute this line of code in my unit test, I get an exception:
âGetSession()â threw an exception of type âSystem.NotImplementedExceptionâ
âThis AppHost does not support accessing the current Request via a Singletonâ
How can I unit test this service?