コード例 #1
0
        public void PluginSettings_Read_Write_Double_Works()
        {
            _PluginSettings.Write(_Plugin, "a", 1.2);
            _PluginSettings.Write(_Plugin, "b", 2.3);
            _PluginSettings.Write(_Plugin, "c", (int?)null);

            Assert.AreEqual(3, _PluginSettings.Values.Count);
            Assert.AreEqual("1.2", _PluginSettings.Values["x.a"]);
            Assert.AreEqual("2.3", _PluginSettings.Values["x.b"]);
            Assert.AreEqual(null, _PluginSettings.Values["x.c"]);

            Assert.AreEqual(null, _PluginSettings.ReadDouble(_Plugin, "z"));
            Assert.AreEqual(1.2, _PluginSettings.ReadDouble(_Plugin, "z", 1.2));
            Assert.AreEqual(2.3, _PluginSettings.ReadDouble(_Plugin, "z", 2.3));

            Assert.AreEqual(1.2, _PluginSettings.ReadDouble(_Plugin, "a"));
            Assert.AreEqual(2.3, _PluginSettings.ReadDouble(_Plugin, "b"));
            Assert.AreEqual(null, _PluginSettings.ReadDouble(_Plugin, "c"));

            Assert.AreEqual(1.2, _PluginSettings.ReadDouble(_Plugin, "a", 99.0));
            Assert.AreEqual(2.3, _PluginSettings.ReadDouble(_Plugin, "b", 99.0));
            Assert.AreEqual(1.2, _PluginSettings.ReadDouble(_Plugin, "c", 1.2));
            Assert.AreEqual(2.3, _PluginSettings.ReadDouble(_Plugin, "c", 2.3));
        }