*this is just a though*

Are you testing HttpContext.Current.GetGlobalResource( ) itself or the code
up until that point?

If the latter then could you replace all your GetGlobalResource( ) calls
with your own static method? You could then use IoC to plugin in either the
real GetGlobalResource or your own GetResource( )

Wal

-----Original Message-----
From: [email protected] [mailto:[email protected]]
On Behalf Of silky
Sent: Friday, 10 September 2010 7:11 PM
To: ozDotNet
Subject: Unit Testing and ASP.NET Resources

Has anyone done anything in this area?

The problem is, when tests are run from your unit testing framework
(NUnit in my case), the calls to
HttpContext.Current.GetGlobalResource(...) fail, obviously because
there is no current HttpContext, but also perhaps less obviously
because the resources don't exist in the project that I'm testing.

I actually would like to test that the resources get returned
correctly. (i.e. I want to have tests that run over a bunch of
different languages checking that the results from various calls
result in appropriate-language output). Clearly, one component of the
solution will be a postbuild task to make sure the resources are
copied to the testing project, but the harder problem to solve is how
to make the calls work. Obviously, some IoC scheme is not a legitimate
option.

Anyone have any thoughts? Have I missed an obvious solution? Hope so.

-- 
silky

http://dnoondt.wordpress.com/

"Every morning when I wake up, I experience an exquisite joy - the joy
of being this signature."

Reply via email to