I am trying to change some Application Settings that live within the Settings of a Windows Service which would be set during installation. The settings I want to set for a Unit Test.
Now, the assemblyinfo file has the InternalsVisibleTo to the Unit Test Project.
In my Test Method I can go drill down to Settings.Default on the Project I want to test and I can see all the settings. However, when I go for instance:
dummy.PropertyValues["MySetting"].PropertyValue = "SomeValue";
I get a null reference exception.
dummy is set as:
var dummy = MyProject.Properties.Settings.Default;
Is there away I can set the Application Settings I want for a unit test?
The problem seems to be with Visual Studio 2010.
After restarting it, and as the Unit Test already had access via assembleyInfo.cs, I was able to set the Property Setting as described in my question.