public void SubstorageSettingsPUT1([PexAssumeUnderTest] MemorySettingsStorage storage1, [PexAssumeUnderTest] String subStorageName, [PexAssumeUnderTest] String settingName, [PexAssumeNotNull] Object settingValue) { ISettingsStorage sub = storage1.MakeChildStorage(subStorageName); sub.SaveSetting(settingName, settingValue); PexAssert.AreEqual(settingValue, sub.GetSetting(settingName)); sub.RemoveSetting(settingName); PexAssert.IsNull(sub.GetSetting(settingName)); }
public void Convert() { Convert("Form.x-location", "Gui.MainForm.Left"); Convert("Form.x-location", "Gui.MiniForm.Left"); Convert("Form.y-location", "Gui.MainForm.Top"); Convert("Form.y-location", "Gui.MiniForm.Top"); Convert("Form.width", "Gui.MainForm.Width"); Convert("Form.width", "Gui.MiniForm.Width"); Convert("Form.height", "Gui.MainForm.Height"); Convert("Form.height", "Gui.MiniForm.Height"); Convert("Form.maximized", "Gui.MainForm.Maximized", "False", "True"); Convert("Form.maximized", "Gui.MiniForm.Maximized", "False", "True"); Convert("Form.font", "Gui.MainForm.Font"); Convert("Form.font", "Gui.MiniForm.Font"); Convert("Form.tree-splitter-position", "Gui.MainForm.SplitPosition"); Convert("Form.tab-splitter-position", "Gui.ResultTabs.ErrorsTabSplitterPosition"); Convert("Options.TestLabels", "Gui.ResultTabs.DisplayTestLabels", "False", "True"); Convert("Options.FailureToolTips", "Gui.ResultTabs.ErrorTab.ToolTipsEnabled", "False", "True"); Convert("Options.EnableWordWrapForFailures", "Gui.ResultTabs.ErrorTab.WordWrapEnabled", "False", "True"); Convert("Options.InitialTreeDisplay", "Gui.TestTree.InitialTreeDisplay", "Auto", "Expand", "Collapse", "HideTests"); Convert("Options.ShowCheckBoxes", "Gui.TestTree.ShowCheckBoxes", "False", "True"); Convert("Options.LoadLastProject", "Options.LoadLastProject", "False", "True"); Convert("Options.ClearResults", "Options.TestLoader.ClearResultsOnReload", "False", "True"); Convert("Options.ReloadOnChange", "Options.TestLoader.ReloadOnChange", "False", "True"); Convert("Options.RerunOnChange", "Options.TestLoader.RerunOnChange", "False", "True"); Convert("Options.ReloadOnRun", "Options.TestLoader.ReloadOnRun", "False", "True"); Convert("Options.MergeAssemblies", "Options.TestLoader.MergeAssemblies", "False", "True"); //Convert( "Options.MultiDomain", "Options.TestLoader.MultiDomain", "False", "True" ); Convert("Options.AutoNamespaceSuites", "Options.TestLoader.AutoNamespaceSuites", "False", "True"); Convert("Options.VisualStudioSupport", "Options.TestLoader.VisualStudioSupport", "False", "True"); Convert("Recent-Projects.MaxFiles", "RecentProjects.MaxFiles"); object val = legacy.GetSetting("Options.MultiDomain"); if (val != null && (bool)val) { this.SaveSetting("Options.TestLoader.DomainUsage", NUnit.Core.DomainUsage.Multiple); } int maxFiles = this.GetSetting("RecentProjects.MaxFiles", 5); for (int i = 1; i <= maxFiles; i++) { string fileKey = string.Format("File{0}", i); object fileEntry = legacy.GetSetting("Recent-Projects." + fileKey); if (fileEntry != null) { this.SaveSetting("RecentProjects." + fileKey, fileEntry); } } }
//check for saved substorage settings removed public void SubstorageSettingsPUT2([PexAssumeUnderTest] String subName, [PexAssumeUnderTest] String[] name, [PexAssumeUnderTest] Object[] value) { PexAssume.IsTrue(name.Length == value.Length); for (int i = 0; i < value.Length; i++) { PexAssume.IsTrue(value[i] is String || value[i] is int); PexAssume.IsNotNullOrEmpty(name[i]); PexAssume.IsNotNull(value[i]); PexAssume.IsTrue(name[i].Contains("t")); } for (int i = 0; i < name.Length; i++) { PexAssume.IsNotNullOrEmpty(name[i]); } ISettingsStorage sub = storage.MakeChildStorage(subName); for (int j = 0; j < value.Length; j++) { sub.SaveSetting(name[j], value[j]); } for (int j = 0; j < value.Length; j++) { String curr = name[j]; sub.RemoveSetting(curr); PexAssert.IsNull(sub.GetSetting(curr), curr + " not removed"); } }
public void SubstorageSettings() { ISettingsStorage sub = storage.MakeChildStorage("Sub"); sub.SaveSetting("X", 5); sub.SaveSetting("NAME", "Charlie"); Assert.AreEqual(5, sub.GetSetting("X")); Assert.AreEqual("Charlie", sub.GetSetting("NAME")); sub.RemoveSetting("X"); Assert.IsNull(sub.GetSetting("X"), "X not removed"); Assert.AreEqual("Charlie", sub.GetSetting("NAME")); sub.RemoveSetting("NAME"); Assert.IsNull(sub.GetSetting("NAME"), "NAME not removed"); }
private void Load(ISettingsStorage settingsStorage) { TargetType = settingsStorage.GetSetting(TargetTypeSettingName, PublishTargetType.Dacpac); TargetDatabaseConnection = settingsStorage.GetSetting(TargetDatabaseConnectionSettingName, string.Empty); TargetProject = settingsStorage.GetSetting(TargetProjectSettingName, string.Empty); TableName = settingsStorage.GetSetting(TableNameSettingName, DefaultRCodeTableName); CodePlacement = settingsStorage.GetSetting(CodePlacementSettingName, RCodePlacement.Inline); QuoteType = settingsStorage.GetSetting(QuoteTypeSettingName, SqlQuoteType.None); }
public static void LoadPropertyValues(this ISettingsStorage settings, object o) { var properties = o.GetType().GetTypeInfo().GetProperties(); foreach (var p in properties) { if (settings.SettingExists(p.Name)) { try { var value = settings.GetSetting(p.Name, p.PropertyType); p.SetValue(o, value); } catch (ArgumentException) { } // protect from settings store damage } } }
public async Task NoDbProjectList() { _storage.GetSetting(SqlSProcPublishSettings.TargetTypeSettingName, PublishTargetType.Dacpac).Returns(PublishTargetType.Project); var settings = new SqlSProcPublishSettings(_storage); var model = await SqlPublishOptionsDialogViewModel.CreateAsync(settings, _coreShell, _pss, _pcsp); model.Settings.TargetType.Should().Be(PublishTargetType.Project); model.Targets.Should().HaveCount(1); model.Targets[0].Should().Be(Resources.SqlPublishDialog_NoDatabaseProjects); }
//check for substorage setting save public void SubstorageSettingsPUT1([PexAssumeUnderTest] String subName, [PexAssumeUnderTest] String[] name, Object[] value) { //constraints for NOT NULL Arrays PexAssume.IsNotNull(value); //constraints for equal size arrays PexAssume.IsTrue(name.Length == value.Length); for (int i = 0; i < value.Length; i++) { //constraint for the TYPE of Object to be created PexAssume.IsTrue(value[i] is String || value[i] is int); //constraint for each name to be NOT NULL PexAssume.IsNotNull(name[i]); PexAssume.IsTrue(name[i].Contains("t")); //constraint for each value to be NOT NULL PexAssume.IsNotNull(value[i]); } //Constratraint to avoid duplicate values for (int i = 0; i < name.Length; i++) { for (int j = 0; j < name.Length; j++) { PexAssume.IsFalse(name[j].Equals(name[j])); } } ISettingsStorage sub = storage.MakeChildStorage(subName); for (int j = 0; j < value.Length; j++) { sub.SaveSetting(name[j], value[j]); } for (int j = 0; j < value.Length; j++) { PexAssert.AreEqual(value[j], sub.GetSetting(name[j])); } }
/// <summary> /// Load the value of one of the group's settings /// </summary> /// <param name="settingName">Name of setting to load</param> /// <returns>Value of the setting or null</returns> public object GetSetting(string settingName) { return(storage.GetSetting(settingName)); }