For an update on this, incase anyone is interested, it turns out it's
kind of solved in my environment (.NET 3.5/MVC).
Specifically, inside a controller when you have something like:
HttpContext.GetGlobalResourceObject("Messages", "SomeMessage")
It refers to an object that you can mock (or just create your own
implementation of). I went for the creating-your-own-implementation
approach, such that my test code looks something like:
public void SomeControllerTest ()
{
SomeController controller = GetController();
controller.Foo();
}
...
private BookingController GetController ()
{
BookingController controller = new BookingController();
RouteData routes = new RouteData();
controller.ControllerContext = new ControllerContext(new
FakeHttpContext(), routes, controller);
return controller;
}
...
public class FakeHttpContext : System.Web.HttpContextBase
{
public override object GetGlobalResourceObject (string classKey,
string resourceKey)
{
return classKey + "_" + resourceKey;
}
}
So, you can see that I'm not really loading the resources themselves,
just displaying the appropriate message (which I can then check via
tests). Pretty convenient. You can implement various other relevant
functions if you are so inclined. The classes are in the
"System.Web.Abstractions" namespace, which allows for the
mocking/re-implementing of various other relevant classes.
--
silky
http://dnoondt.wordpress.com/
"Every morning when I wake up, I experience an exquisite joy — the joy
of being this signature."