So, I work with Umbraco 6.12 and with great difficulty I was able to test RenderMvcController .
I implemented IApplicationEventHandler in my Global.ascx , and Ninject works fine and, as expected, when the application starts, everything is fine.
However, unit testing these controllers is another matter. I found this and added the last answer:
http://issues.umbraco.org/issue/U4-1717
Now I have this beautiful hack in my SetUp:
Umbraco.Web.UmbracoContext.EnsureContext(new HttpContextWrapper(new HttpContext(new HttpRequest("", "http://www.myserver.com", ""), new HttpResponse(null))), ApplicationContext.Current);
Which will cost the original UmbracoContext may not be null, but now throws:
The current one has not been initialized to Umbraco.Web.PublishedCache.PublishedCachesResolver. You must initialize Current before attempting to read it.
The published cache recognizer also hides behind internal and protected things that I cannot use for reflection, so as not to crack, because I can not start to go into reflection in SetProperty .
This is really frustrating, I love v6, and using uMapper is very nice. I can enter the repo, service, team or request of my choice into the controllers, and life is good - I just can't cover the controllers!
Any help on this would be greatly appreciated.
Thanks.