Unit Testing a Web Application Project with NUnit 2.4.6

My web application project works just fine, but I'm trying to start unit testing with NUnit. I have the Test and TestFixture properly set-up, but when I actually run a test against the project's DLL in my bin, the test case fails with the message that it cannot load the App_GlobalAssemblies. (The Trace tab says that App_GlobalResources is not a strong name.)

App_GlobalResources is a regular folder for Web Application Projects. It contains my Constants.resx file. The expression in my code that triggers the failure is: Resources.Constants.KeyValueName (where KeyValueName is the name of one of the key-value pairs in my resx file).

NUnit correctly makes its way to Constants.designer.cs, to try to call Assembly.Load(). Here's the rest of the stack trace. (The top line is ultimately where the failure happens.)

at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)

Any ideas on integrating NUnit for a project that uses App_GlobalResources? I *really* want to be able to perform unit testing.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
Are you using NUnitASP?


davidlambAuthor Commented:
Not yet.
Bob LearnedCommented:
I haven't tried regular NUnit with ASP.NET web sites, so I couldn't say that it is even possible.

davidlambAuthor Commented:
Well, given that NUnitASP is simply an extension to NUnit, I would assume that it won't do me any good if I can't use regular NUnit. Plus, I'm not sure I want to bother learning NUnitASP, since nobody's maintaining it anymore (as was announced last Thursday).
davidlambAuthor Commented:
After some more work, I've found my own solution.
1. Put the TestFixture within the web application itself. (Otherwise it won't be able to read ANY resx file.)
2. Move Constants.resx out of App_GlobalResources. You can still use it the same way, just from a different namespace (e.g., Code.Constants.resx instead of Resources.Constants.resx).

Simply doing that made everything hunky-dory. I simply wasn't aware that you could have resx files outside of App_GlobalResources. You learn something new everyday!

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.