public static GherkinTestFrameworkSettingsFacade GetInstance() { var settings = ConfigurationManager.GetSection("gherkinTestFrameworkSettings") as GherkinTestFrameworkSettings ?? GherkinTestFrameworkSettings.GetInstanceWithDefaultValues(); return(new GherkinTestFrameworkSettingsFacade(settings)); }
public static GherkinTestFrameworkSettings GetInstanceWithDefaultValues() { var settings = new GherkinTestFrameworkSettings(); foreach (var propertyInfo in typeof (GherkinTestFrameworkSettings).GetProperties()) { var attribute = (ConfigurationPropertyAttribute) propertyInfo .GetCustomAttributes(typeof (ConfigurationPropertyAttribute), false) .SingleOrDefault(); if (attribute != null && propertyInfo.CanWrite) { propertyInfo.SetValue(settings, attribute.DefaultValue, null); } } return settings; }
public static GherkinTestFrameworkSettings GetInstanceWithDefaultValues() { var settings = new GherkinTestFrameworkSettings(); foreach (var propertyInfo in typeof(GherkinTestFrameworkSettings).GetProperties()) { var attribute = (ConfigurationPropertyAttribute) propertyInfo .GetCustomAttributes(typeof(ConfigurationPropertyAttribute), false) .SingleOrDefault(); if (attribute != null && propertyInfo.CanWrite) { propertyInfo.SetValue(settings, attribute.DefaultValue, null); } } return(settings); }
private GherkinTestFrameworkSettingsFacade(GherkinTestFrameworkSettings settings) { _settings = settings; }