views:

76

answers:

1

I have an Azure application, and recently went gung-ho on the application settings. I realized putting pretty much every setting I needed into the ServiceConfiguration was the obvious way to go for anything you might even remotely want to change on the fly; which means web service URLs, smtp host information, etc is all in my ServiceConfiguration.

Imagine my suprise when, after I made my changes, I tried to run my 200+ unit tests, only to smack straight into this error:

http://stackoverflow.com/questions/2957938/why-am-i-getting-sehexception-when-calling-roleenvironment-getconfigurationsettin

Obviously, I have several options here...

-I can write my own small class using RoleEnvironment.IsAvailable() to check where I should be getting my settings from, and get them from the app.config if i'm not in azure.

-I could deploy my application to the test environment, and just test the externally-facing interfaces.

But is there a "built-in" way? Are there any updates to the unit testing framework that would let me test the exact code that's running (within the environment it will be run in and with the settings that will be deployed)?

+1  A: 

As far as I'm aware there is no built in way in the testing framework for testing which version of the config settings you should be using. I'm using a wrapper class like the one you describe (which I'm sure you already know is simple to write), but mainly so that we can run our websites outside of the dev fabric.

knightpfhor
Thanks. That's the same conclusion I came to as well. I appreciate the confirmation.
Steve