public void MigrateSettingsNoChanges() { TestSettingsStore.Instance.Reset(); var settings = new MigrationAppSettings(); SettingsMigrator.MigrateSharedSettings(typeof(MigrationAppSettings), null); var settings3 = new MigrationAppSettings(); Assert.AreEqual(settings3.App1, MigrationAppSettings.DefaultValueApp); Assert.AreEqual(settings3.App2, MigrationAppSettings.DefaultValueApp); Assert.AreEqual(settings3.App3, MigrationAppSettings.DefaultValueApp); }
public void MigrateSettings() { TestSettingsStore.Instance.Reset(); var settings = new MigrationAppSettings(); const string testVal1 = "A man, a plan, a canal, panama"; const string testVal2 = "Now is the time for all good men to come to the aide of their country"; settings.App1 = testVal1; settings.App2 = testVal2; settings.Save(); Assert.IsTrue(SettingsMigrator.MigrateSharedSettings(typeof(MigrationAppSettings), null)); var settings1a = new MigrationAppSettings(); Assert.AreEqual(settings1a.App1, testVal1); Assert.AreEqual(settings1a.App2, testVal2); Assert.AreEqual(settings1a.App3, MigrationAppSettings.DefaultValueApp); var group = new SettingsGroupDescriptor(typeof(MigrationAppSettings)); TestSettingsStore.Instance.GetPreviousSettingsGroup(group); TestSettingsStore.Instance.RemoveSettingsGroup(group); var settings2 = new MigrationAppSettings(); Assert.AreEqual(settings2.App1, MigrationAppSettings.DefaultValueApp); Assert.AreEqual(settings2.App2, MigrationAppSettings.DefaultValueApp); Assert.AreEqual(settings2.App3, MigrationAppSettings.DefaultValueApp); Assert.IsTrue(SettingsMigrator.MigrateSharedSettings(typeof(MigrationAppSettings), null)); var settings3 = new MigrationAppSettings(); Assert.AreEqual(settings3.App1, testVal1 + TestSettingsStore.TestString); Assert.AreEqual(settings3.App2, testVal2 + TestSettingsStore.TestString); Assert.AreEqual(settings3.App3, MigrationAppSettings.DefaultValueApp); }