public void SaveWriteAndRetrieveSingularValueTest() { ConfigManipulator target = new ConfigManipulator(testAppConfigPath); string currentServer = target.GetValue("Server"); target.SaveValue("Server", currentServer + "a"); target.WriteConfig(testAppConfigPath); Assert.AreEqual(target.GetValue("Server"), currentServer + "a"); }
public void SaveAndRetrieveDictionaryValueTest() { Dictionary <object, object> firstDictionary = new Dictionary <object, object> { { (int)1, "a longer string" }, { (int)2, @"a messud up string" }, { (int)3, @"a string with some icky characters! <a><&b><c;>" }, { "asdf", @"a string with some icky characters! <a><&b><<c;> " }, { false, @"true" }, { true, @"false" } }; ConfigManipulator target = new ConfigManipulator(testAppConfigPath); target.SaveValue(firstDictionary, "test1"); Dictionary <object, object> retrievedDictionary = target.GetDictionary("test1"); foreach (object o in retrievedDictionary.Keys) { object a = firstDictionary[o]; object b = retrievedDictionary[o]; Assert.AreEqual(firstDictionary[o], retrievedDictionary[o]); } Dictionary <object, object> secondDictionary = new Dictionary <object, object> { { "", "a longer string" }, { "a longer string", @"a messud up string" }, { "a string with some icky characters! <a><&b><c;>", @"a string with some icky characters! <a><&b><c;>" } }; target = new ConfigManipulator(testAppConfigPath); target.SaveValue(secondDictionary, "test2"); retrievedDictionary = target.GetDictionary("test2"); foreach (object o in retrievedDictionary.Keys) { object a = secondDictionary[o]; object b = retrievedDictionary[o]; Assert.AreEqual(secondDictionary[o], retrievedDictionary[o]); } }