Where does ApplicationSettingsBase save config files during unit testing?

Matt Shubert picture Matt Shubert · Jun 17, 2011 · Viewed 7.1k times · Source

Some background context: I'm deriving from ApplicationSettingsBase to save custom sets of configuration settings in my application, and the manual testing is working fine, the config sets are being saved no problem.

I also wanted to unit test my ConfigSettings functionality to ensure that both de-serialization and saving multiple sets of settings (using various SettingsKeys) are working. My unit test framework of choice is NUnit.

My TextFixtureSetUp method looks like this:

var configSettingsTest = new ConfigSettings("TestSettings");

configSettingsTest.Name = "TestName";
// ...lots of other initializations...

// Serialize the data
configSettingsTest.Save();

In my actual application, it looks like the config settings are being saved in

"<user>\AppData\Local\<myApplication>\<crazyHashKey>"

But I can't seem to find where the settings are being saved in my unit tests. I mean, the tests are succeeding, so the de-serialization is (presumably) working, but I have no idea where exactly they're being written to on disk, and the ApplicationSettingsBase class doesn't seem to have any way to specify a Save path.

Anyone have any ideas?

Matt Shubert

UPDATE

I found out what was happening. I was using Resharper to run my NUnit tests from within Visual Studio, and Resharper creates its own isolated AppDomain. So the ConfigSettings were being saved in

"<user>\AppData\Local\JetBrains\<crazyHashKey>"

(JetBrains is the company behind Resharper)

I tested this using my build script from the command line and found that NUnit does something similar, so the ConfigSettings were now in

"<user>\AppData\Local\NUnit.org\<crazyHashKey>"

Hope this helps anyone else who has a similar question! :)

Answer