开发者

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

This question is unlikely to help any future visitors; it is only relevant to a small geog开发者_如何学编程raphic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 10 years ago.

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜