Esempio n. 1
0
        public void DeleteValueTest()
        {
            var value = new KeyValuePair<string, string>(Guid.NewGuid().ToString(), Guid.NewGuid().ToString());
            var settings = new JsonSettings(GetMockFileSystem(SettingsPath), SettingsPath);

            Assert.Equal(null, settings.GetValue(value.Key));

            settings.SetValue(value.Key, value.Value);
            Assert.Equal(value.Value, settings.GetValue(value.Key));

            // Delete existing value
            Assert.Equal(true, settings.DeleteValue(value.Key));

            Assert.Equal(null, settings.GetValue(value.Key));

            // Delete non-existing value
            Assert.False(settings.DeleteValue(value.Key));
        }
Esempio n. 2
0
        public void ConstructorTest()
        {
            IFileSystem fileSystem = GetMockFileSystem(SettingsPath);

            var settings = new JsonSettings(SettingsPath);

            Assert.Equal(null, settings.GetValue("non_existing"));

            Assert.Equal(0, settings.GetValues().Count());

            Assert.False(settings.DeleteValue("non_existing"));

            Assert.False(FileSystemHelpers.FileExists(SettingsPath));
        }