Skip to content

Instantly share code, notes, and snippets.

@jole78
Created May 9, 2013 20:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jole78/5550163 to your computer and use it in GitHub Desktop.
Save jole78/5550163 to your computer and use it in GitHub Desktop.
Shows an example of how to enable environment specfic settings in SpecFlow
[Binding]
public class EnvironmentSettingsSupport
{
private static IObjectContainer m_Container;
public EnvironmentSettingsSupport(IObjectContainer container)
{
m_Container = container;
}
[BeforeScenario]
public void InitializeEnvironment()
{
// settings are hardcoded
#if DEBUG
{
var settings = new HardcodedSettings();
m_Container.RegisterInstanceAs<IEnvironmentSettings>(settings);
}
#endif
// enables the user to configure the settings via xml
#if RELEASE
{
var settings = new ConfigurableSettings();
m_Container.RegisterInstanceAs<IEnvironmentSettings>(settings);
}
#endif
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment