Exemple #1
0
        public void WriteXml_BadPath_NoError()
        {
            var objectIn = new TestObject {
                Name = TestObjectName
            };

            ConfigSerializer.WriteXml(null, objectIn);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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));
        }