public void RemoveSettings()
        {
            storage.SaveSetting("X", 5);
            storage.SaveSetting("NAME", "Charlie");

            storage.RemoveSetting("X");
            Assert.IsNull(storage.GetSetting("X"), "X not removed");
            Assert.AreEqual("Charlie", storage.GetSetting("NAME"));

            storage.RemoveSetting("NAME");
            Assert.IsNull(storage.GetSetting("NAME"), "NAME not removed");
        }
        public void RemoveSettings()
        {
            RegistrySettingsStorage storage = new RegistrySettingsStorage("Test", testKey);

            storage.SaveSetting("X", 5);
            storage.SaveSetting("NAME", "Charlie");

            storage.RemoveSetting("X");
            Assert.IsNull(storage.LoadSetting("X"), "X not removed");
            Assert.AreEqual("Charlie", storage.LoadSetting("NAME"));

            storage.RemoveSetting("NAME");
            Assert.IsNull(storage.LoadSetting("NAME"), "NAME not removed");
        }
示例#3
0
        public void RemoveSettingsPUT1([PexAssumeUnderTest] String[] name, [PexAssumeUnderTest] Object[] value)
        {
            PexAssume.IsTrue(value.Length < 255);
            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++)
            {
                storage.SaveSetting(name[i], value[i]);
            }
            for (int i = 0; i < name.Length; i++)
            {
                if (storage.GetSetting(name[i]) != null)
                {
                    storage.RemoveSetting(name[i]);
                    PexAssert.IsNull(storage.GetSetting(name[i]), name[i] + " not removed");
                }
            }
        }