public void PersistentFileHandler_EmptySettings() { PersistentSettings settings = new PersistentSettings(); Assert.IsTrue(ValidateEmptySettings(settings)); PersistentFileHandler fileHandler = new PersistentFileHandler("TestFileHandler"); Assert.IsTrue(fileHandler.Save(persistentFileName, settings)); PersistentSettings loadedSettings = fileHandler.Load(persistentFileName); Assert.IsTrue(ValidateEmptySettings(loadedSettings)); }
public void PersistentFileHandler_PopulatedSettings() { PersistentSettings settings = new PersistentSettings(); Assert.IsTrue(ValidateEmptySettings(settings)); settings.TaskList.Add(new Task()); settings.PhaseList.Add(new Phase()); settings.PhaseList.Add(new Phase()); settings.ContractList.Add(new Contract()); settings.ContractList.Add(new Contract()); settings.ContractList.Add(new Contract()); settings.UserList.Add(new User()); settings.UserList.Add(new User()); settings.UserList.Add(new User()); settings.UserList.Add(new User()); settings.CustomItems["String_1"] = "SomeValue"; settings.CustomItems["String_2"] = "AnotherValue"; settings.CustomItems["Number_1"] = "1"; PersistentFileHandler fileHandler = new PersistentFileHandler("TestFileHandler"); Assert.IsTrue(fileHandler.Save(persistentFileName, settings)); PersistentSettings loadedSettings = fileHandler.Load(persistentFileName); Assert.IsNotNull(loadedSettings.ContractList); Assert.IsNotNull(loadedSettings.PhaseList); Assert.IsNotNull(loadedSettings.TaskList); Assert.IsNotNull(loadedSettings.UserList); Assert.IsNotNull(loadedSettings.CustomItems); Assert.AreEqual(loadedSettings.ContractList.Count, 3); Assert.AreEqual(loadedSettings.PhaseList.Count, 2); Assert.AreEqual(loadedSettings.TaskList.Count, 1); Assert.AreEqual(loadedSettings.UserList.Count, 4); Assert.AreEqual(loadedSettings.CustomItems.Count, 3); }