Hi,
You have managed to find a case that TypeMock has some difficulties mocking.
What happens is that ConfigurationManager is called whenever an executable is first run (This is before TypeMock is run) and once JITTed there is not much TypeMock can do.
The second time it is run TypeMock is already running and can mock that class.
I would really advise in this case, to use more conventional methods:
For example you can switch your configuration file to the one tested as follows:
Put the test config file in C: estConfigurationManager.exe.config
// Get the machine.config file.
ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap();
// You may want to map to your own exe.comfig file here.
fileMap.ExeConfigFilename = @"C: estConfigurationManager.exe.config";
System.Configuration.Configuration config = ConfigurationManager.OpenMappedExeConfiguration(fileMap,
ConfigurationUserLevel.None);
Note: This is not the only way to test this, there are other ways to modify the configuration without mocking.