Testing code in GAC with NUnit

I often run test codes that reference methods of business class and the class is compiled and stored in GAC. Sometimes, I update the method but NUnit keeps running the old code. What I did was

  • Visual Studio’s Clean (this deletes all assemblies under the test project)
  • reset iis. this is supposed to flush GAC
  • rebuild the business class.

But still it did not work. I slept on it and the next morning, I remembered I didn’t restart NUnit and NUnit might hold the old assembly in its own memory. I closed NUnit and opened it, and the new method was loaded. Fantastic.

So, when you changed your method but can’t see it working, restart NUnit!

Added in 3 days later

To ensure NUnit loads the newly compile dll, please do

  • Rebuild the whole solution of your GAC code
  • Clean adn rebuild your testing code
  • Close NUnit and start it again.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s