public void BadSetting2() { RegistrySettingsStorage storage = new RegistrySettingsStorage("Test", testKey); storage.SaveSetting("X", "1y25"); int x = storage.LoadIntSetting("X", 12); }
public void TypeSafeSettings() { RegistrySettingsStorage storage = new RegistrySettingsStorage("Test", testKey); storage.SaveSetting("X", 5); storage.SaveSetting("Y", "17"); storage.SaveSetting("NAME", "Charlie"); Assert.AreEqual(5, storage.LoadSetting("X")); Assert.AreEqual(5, storage.LoadIntSetting("X")); Assert.AreEqual("5", storage.LoadStringSetting("X")); Assert.AreEqual("17", storage.LoadSetting("Y")); Assert.AreEqual(17, storage.LoadIntSetting("Y")); Assert.AreEqual("17", storage.LoadStringSetting("Y")); Assert.AreEqual("Charlie", storage.LoadSetting("NAME")); Assert.AreEqual("Charlie", storage.LoadStringSetting("NAME")); }
public void DefaultSettings() { RegistrySettingsStorage storage = new RegistrySettingsStorage("Test", testKey); Assert.IsNull(storage.LoadSetting("X")); Assert.IsNull(storage.LoadSetting("NAME")); Assert.AreEqual(5, storage.LoadSetting("X", 5)); Assert.AreEqual(6, storage.LoadIntSetting("X", 6)); Assert.AreEqual("7", storage.LoadStringSetting("X", "7")); Assert.AreEqual("Charlie", storage.LoadSetting("NAME", "Charlie")); Assert.AreEqual("Fred", storage.LoadStringSetting("NAME", "Fred")); }