コード例 #1
0
        public void TestSerializedSettingsManagerWriting()
        {
            string filePath = @".\Settings.xml";

            SerializedSettingsManager.SaveSettings(this.settingsManager, filePath);

            Assert.IsTrue(File.Exists(filePath));
        }
コード例 #2
0
        public void TestSerializedSettingsManagerLoading()
        {
            string filePath = @".\Settings.xml";

            SerializedSettingsManager.SaveSettings(this.settingsManager, filePath);

            var newSettings = SerializedSettingsManager.LoadSettings <MySerializedSettingsManager>(filePath);

            Assert.AreEqual(settingsManager.intSetting.Value, newSettings.intSetting.Value);
            Assert.AreEqual(settingsManager.floatSetting.Value, newSettings.floatSetting.Value);
            Assert.AreEqual(settingsManager.boolSetting.Value, newSettings.boolSetting.Value);
            Assert.AreEqual(settingsManager.stringSetting.Value, newSettings.stringSetting.Value);

            for (int i = 0; i < settingsManager.stringSettingList.Count; ++i)
            {
                Assert.AreEqual(settingsManager.stringSettingList[i].Value, newSettings.stringSettingList[i].Value);
            }
        }