public SettingsPropertyMigrationValues(string propertyName, MigrationScope migrationScope, object currentValue, object previousValue) { PropertyName = propertyName; MigrationScope = migrationScope; CurrentValue = currentValue; PreviousValue = previousValue; }
private static void ValidateStoredValues(Type type, MigrationScope migrationScope, SettingValue expectedValue) { var settings = ApplicationSettingsHelper.GetSettingsClassInstance(type); foreach (SettingsProperty property in settings.Properties) { string expected = CreateSettingValue(property, migrationScope, expectedValue); if (migrationScope == MigrationScope.User) { if (SettingsPropertyExtensions.IsAppScoped(property)) { continue; } string actual = (string)settings[property.Name]; Assert.AreEqual(expected, actual); } else { if (SettingsPropertyExtensions.IsAppScoped(property)) { string actual = (string)settings[property.Name]; Assert.AreEqual(expected, actual); } string shared = (string)ApplicationSettingsExtensions.GetSharedPropertyValue(settings, property.Name); Assert.AreEqual(expected, shared); } } }
private void ValidateValuesInConfig(MigrationScope migrationScope, SettingValue settingValue) { var configuration = GetExeConfiguration(); var values = SystemConfigurationHelper.GetSettingsValues(configuration, _settingsClass); ValidateValues(values, migrationScope, settingValue); }
private void ValidateValuesInConfig(Type settingsClass, MigrationScope migrationScope, SettingValue settingValue) { var configuration = GetExeConfiguration(); var values = configuration.GetSettingsValues(settingsClass); ValidateValues(settingsClass, values, migrationScope, settingValue); }
private static void MigrateProperty(IMigrateSettings customMigrator, MigrationScope migrationScope, SettingsPropertyValue currentValue, object previousValue) { var migrationValues = new SettingsPropertyMigrationValues( currentValue.Property.Name, migrationScope, currentValue.PropertyValue, previousValue); customMigrator.MigrateSettingsProperty(migrationValues); if (!Equals(migrationValues.CurrentValue, currentValue.PropertyValue)) currentValue.PropertyValue = migrationValues.CurrentValue; }
private static void MigrateProperty(IMigrateSettings customMigrator, MigrationScope migrationScope, SettingsPropertyValue currentValue, object previousValue) { var migrationValues = new SettingsPropertyMigrationValues( currentValue.Property.Name, migrationScope, currentValue.PropertyValue, previousValue); customMigrator.MigrateSettingsProperty(migrationValues); if (!Equals(migrationValues.CurrentValue, currentValue.PropertyValue)) { currentValue.PropertyValue = migrationValues.CurrentValue; } }
public static Dictionary <string, string> CreateSettingsValues(Type type, MigrationScope migrationScope, SettingValue settingValue) { var values = new Dictionary <string, string>(); SettingsGroupDescriptor group = new SettingsGroupDescriptor(type); foreach (var property in SettingsPropertyDescriptor.ListSettingsProperties(group)) { var value = CreateSettingValue(property, migrationScope, settingValue); if (value != null) { values[property.Name] = value; } } return(values); }
public static string CreateSettingValue(SettingsPropertyDescriptor property, MigrationScope migrationScope, SettingValue settingValue) { if (settingValue == SettingValue.Default) { return(property.DefaultValue); } if (migrationScope == MigrationScope.User && property.Scope == SettingScope.Application) { return(null); } if (property.Scope == SettingScope.User && migrationScope == MigrationScope.Shared) { return(CreateUserDefaultSettingValue(property.Name, settingValue)); } return(CreateSettingValue(property.Name, settingValue)); }
public static string CreateSettingValue(SettingsPropertyDescriptor property, MigrationScope migrationScope, SettingValue settingValue) { if (settingValue == SettingValue.Default) return property.DefaultValue; if (migrationScope == MigrationScope.User && property.Scope == SettingScope.Application) return null; if (property.Scope == SettingScope.User && migrationScope == MigrationScope.Shared) return CreateUserDefaultSettingValue(property.Name, settingValue); return CreateSettingValue(property.Name, settingValue); }
public static string CreateSettingValue(PropertyInfo property, MigrationScope migrationScope, SettingValue settingValue) { return(CreateSettingValue(new SettingsPropertyDescriptor(property), migrationScope, settingValue)); }
public static string CreateSettingValue(SettingsProperty property, MigrationScope migrationScope, SettingValue settingValue) { return(CreateSettingValue(SettingsPropertyHelper.GetDescriptor(property), migrationScope, settingValue)); }
public static SettingsPropertyValue CreateSettingsPropertyValue(SettingsProperty property, MigrationScope migrationScope, SettingValue settingValue) { var value = CreateSettingValue(property, migrationScope, settingValue); if (value == null) { return(null); } return(new SettingsPropertyValue(property) { SerializedValue = value }); }
private void ValidateValues(Dictionary <string, string> values, MigrationScope migrationScope, SettingValue settingValue) { var expected = CreateSettingsValues(_settingsClass, migrationScope, settingValue); ValidateValues(values, expected); }
private void ValidateValues(Dictionary<string, string> values, MigrationScope migrationScope, SettingValue settingValue) { if (settingValue == SettingValue.Default) { Assert.AreEqual(0, values.Count); return; } var expected = CreateSettingsValues(_settingsClass, migrationScope, settingValue); ValidateValues(values, expected); }
public static SettingsPropertyValue CreateSettingsPropertyValue(SettingsProperty property, MigrationScope migrationScope, SettingValue settingValue) { var value = CreateSettingValue(property, migrationScope, settingValue); if (value == null) return null; return new SettingsPropertyValue(property) { SerializedValue = value }; }
private static void ValidateStoredValues(Type type, MigrationScope migrationScope, SettingValue expectedValue) { var settings = ApplicationSettingsHelper.GetSettingsClassInstance(type); foreach (SettingsProperty property in settings.Properties) { string expected = CreateSettingValue(property, migrationScope, expectedValue); if (migrationScope == MigrationScope.User) { if (SettingsPropertyExtensions.IsAppScoped(property)) continue; string actual = (string)settings[property.Name]; Assert.AreEqual(expected, actual); } else { if (SettingsPropertyExtensions.IsAppScoped(property)) { string actual = (string)settings[property.Name]; Assert.AreEqual(expected, actual); } string shared = (string)ApplicationSettingsExtensions.GetSharedPropertyValue(settings, property.Name); Assert.AreEqual(expected, shared); } } }
private void ValidateValues(Dictionary<string, string> values, MigrationScope migrationScope, SettingValue settingValue) { var expected = CreateSettingsValues(_settingsClass, migrationScope, settingValue); ValidateValues(values, expected); }
public static Dictionary<string, string> CreateSettingsValues(Type type, MigrationScope migrationScope, SettingValue settingValue) { var values = new Dictionary<string, string>(); SettingsGroupDescriptor group = new SettingsGroupDescriptor(type); foreach (var property in SettingsPropertyDescriptor.ListSettingsProperties(group)) { var value = CreateSettingValue(property, migrationScope, settingValue); if (value != null) values[property.Name] = value; } return values; }
public static string CreateSettingValue(SettingsProperty property, MigrationScope migrationScope, SettingValue settingValue) { return CreateSettingValue(SettingsPropertyHelper.GetDescriptor(property), migrationScope, settingValue); }
public static string CreateSettingValue(PropertyInfo property, MigrationScope migrationScope, SettingValue settingValue) { return CreateSettingValue(new SettingsPropertyDescriptor(property), migrationScope, settingValue); }