public void EditorProductionKeysRead() { EditorUserRegistrySettings editorRegistry = new EditorUserRegistrySettings(); }
public void EditorTestKeysCreateReuseUpdate() { string testRootKey = Constant.Registry.RootKey + "EditorUnitTest"; using (RegistryKey testKey = Registry.CurrentUser.OpenSubKey(testRootKey)) { if (testKey != null) { Registry.CurrentUser.DeleteSubKeyTree(testRootKey); } } EditorUserRegistrySettings editorRegistry = new EditorUserRegistrySettings(testRootKey); Assert.IsNotNull(editorRegistry.MostRecentTemplates); Assert.IsTrue(editorRegistry.MostRecentTemplates.Count == 0); // write editorRegistry.WriteToRegistry(); // loopback editorRegistry.ReadFromRegistry(); Assert.IsNotNull(editorRegistry.MostRecentTemplates); Assert.IsTrue(editorRegistry.MostRecentTemplates.Count == 0); string mostRecentTemplatePath; Assert.IsFalse(editorRegistry.MostRecentTemplates.TryGetMostRecent(out mostRecentTemplatePath)); // overwrite editorRegistry.WriteToRegistry(); // modify string templatePath = Path.Combine(this.WorkingDirectory, Constant.File.DefaultTemplateDatabaseFileName); editorRegistry.MostRecentTemplates.SetMostRecent(templatePath); editorRegistry.WriteToRegistry(); editorRegistry.ReadFromRegistry(); Assert.IsNotNull(editorRegistry.MostRecentTemplates); Assert.IsTrue(editorRegistry.MostRecentTemplates.Count == 1); Assert.IsTrue(editorRegistry.MostRecentTemplates.TryGetMostRecent(out mostRecentTemplatePath)); Assert.IsTrue(mostRecentTemplatePath == templatePath); Registry.CurrentUser.DeleteSubKeyTree(testRootKey); }