Example #1
0
        public void PostAddItemTest()
        {
            var store  = PropertyHelpers.SamplePropertiesStore();
            var bag1   = store.Find("GUID1");
            var bagBad = store.Find("InvalidGUID");

            // Validate our objects
            Assert.IsNotNull(bag1);
            Assert.IsNull(bagBad);

            // Attempt to add after the fact
            bag1.Add("A-NewKey3", "A-NewValue3");

            // Output data
            var json = JsonConvert.SerializeObject(store, Formatting.Indented);

            Log.Debug(json);

            var tempBag1 = store.Find("GUID1");

            json = JsonConvert.SerializeObject(tempBag1, Formatting.Indented);
            Log.Debug(json);

            var value = tempBag1.Items["A-NewKey3"];

            Assert.IsNotNull(value);
            Assert.AreEqual("A-NewValue3", value);
        }
Example #2
0
        public void SaveClearAndLoadPropertiesFileTest()
        {
            Log.Debug($"Tmp Path: {_settings.SettingsFilePath}");

            var store = PropertyHelpers.SamplePropertiesStore();

            _settings.PropertiesStore = store;

            _settings.SaveFile();
            store.ClearAll();
            Assert.AreEqual(store.PropertyBags.Count, 0);

            _settings.LoadFile();
            Assert.AreNotEqual(store.PropertyBags.Count, 0);

            string json = JsonConvert.SerializeObject(store.PropertyBags, Formatting.Indented);

            Log.Debug(json);
        }