Exemplo n.º 1
0
        public void PluginSettings_Read_Write_Int_Works()
        {
            _PluginSettings.Write(_Plugin, "a", 1);
            _PluginSettings.Write(_Plugin, "b", 2);
            _PluginSettings.Write(_Plugin, "c", (int?)null);

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

            Assert.AreEqual(null, _PluginSettings.ReadInt(_Plugin, "z"));
            Assert.AreEqual(1, _PluginSettings.ReadInt(_Plugin, "z", 1));
            Assert.AreEqual(2, _PluginSettings.ReadInt(_Plugin, "z", 2));

            Assert.AreEqual(1, _PluginSettings.ReadInt(_Plugin, "a"));
            Assert.AreEqual(2, _PluginSettings.ReadInt(_Plugin, "b"));
            Assert.AreEqual(null, _PluginSettings.ReadInt(_Plugin, "c"));

            Assert.AreEqual(1, _PluginSettings.ReadInt(_Plugin, "a", 99));
            Assert.AreEqual(2, _PluginSettings.ReadInt(_Plugin, "b", 99));
            Assert.AreEqual(1, _PluginSettings.ReadInt(_Plugin, "c", 1));
            Assert.AreEqual(2, _PluginSettings.ReadInt(_Plugin, "c", 2));
        }