System.Configuration.Abstractions
System.Configuration.Abstractions copied to clipboard
Mocking out configuration section
I use IConfigurationManager to mock configuration, but I found no easy way to mock values stored in configuration sections.
For example, I want to change session timeout during test.
I get session timeout from web.config in following way:
SessionStateSection section = (SessionStateSection)_configurationManager.GetSection("system.web/sessionState");
sessionTimeout = TimeSpan.FromMinutes((int)section.Timeout.TotalMinutes);
where _configurationManager is instance of IConfigurationManager.
How can I set values for "system.web/sessionState" section using System.Configuration.Abstractions?
Hey - at the moment custom configuration sections aren't supported. There's no reason they can't be however.
I'm on holiday from tomorrow until the 20th, but I'll take a look at this when I get back and see what I can work in.
- D
My congratulations! CU