Where does ApplicationSettingsBase save config files during unit testing? [closed]
Asked Answered
A

0

22

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! :)

Attend answered 17/6, 2011 at 19:31 Comment(2)
Hey Matt, you should make your answer an actual answer and mark it as the correct answer. :-) I read your whole question thinking it was still unanswered 'til I got to the bottom. Haha, no biggie... just a suggestion....Consolata
Closed because "This question is unlikely to help any future visitors ..." and yet it has 17 upvotes. :-)Kailakaile

© 2022 - 2024 — McMap. All rights reserved.