I\'m currently developing a plugin to use in any application, and the configuration of the plugin is done through the usage of either a web.config or an app.config file.
This is what we do (same as @THG) explained in his answer.
public interface IConfiguration
{
string SettingA { get; }
string SettingB { get; }
}
public class Configuration : IConfiguration
{
public string SettingA
{
get
{
return ConfigurationManager.AppSettings["SettingA"];
}
}
public string SettingB
{
get
{
return ConfigurationManager.AppSettings["SettingB"];
}
}
}
Then in your test
var config = MockRepository.GenerateStub();
config.Stub(x => x.SettingA).Return("Fred");