Created
May 9, 2013 20:04
-
-
Save jole78/5550163 to your computer and use it in GitHub Desktop.
Shows an example of how to enable environment specfic settings in SpecFlow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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