public void WriteXml_BadPath_NoError() { var objectIn = new TestObject { Name = TestObjectName }; ConfigSerializer.WriteXml(null, objectIn); }
public void WriteXml_ReadXml_SavesFile() { var objectIn = new TestObject { Name = TestObjectName }; ConfigSerializer.WriteXml(_testFilePath, objectIn); TestObject objectOut = ConfigSerializer.ReadXml(_testFilePath, objectIn); Assert.AreEqual(TestObjectName, objectOut.Name); }
public void LoadSettings_BadConfigWithValidXML_RenamesConfigFile() { // create bad config ConfigSerializer.WriteXml(ConfigFilePath, new object()); // load settings ConfigManager.Initialize(ConfigDirPath, ConfigFileName, new ConfigMock()); var configMgr = (ConfigManager)ConfigManager.GetInstance(); configMgr.Config = new ConfigMock(); ConfigManager.GetInstance().LoadSettings(); ConfigManager.GetInstance().SaveSettings(); Assert.IsTrue(File.Exists(ConfigFilePath)); Assert.IsTrue(File.Exists(ConfigPreviousFilePath)); }