示例#1
0
        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;
        }
示例#3
0
        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;
 }
示例#5
0
 private GherkinTestFrameworkSettingsFacade(GherkinTestFrameworkSettings settings)
 {
     _settings = settings;
 }