Exemplo n.º 1
0
        public void BoolSetGet()
        {
            Pixini p = new Pixini();

            p.Set("Booler", "My", true);

            Assert.AreEqual(true, p.Get<bool>("Booler", "My"));
        }
Exemplo n.º 2
0
        public void FloatSetGet()
        {
            Pixini p = new Pixini();

            p.Set("Floater", "My", 560.896f);

            Assert.AreEqual(560.896f, p.Get<float>("Floater", "My"));
        }
Exemplo n.º 3
0
        public void CaseInsensitivity()
        {
            Pixini p = new Pixini();

            //Set using the index property
            p["CaseTest", "My"] = "suit";

            //Test Section Case insensitivity
            Assert.AreEqual("suit", p["Casetest", "my"]);

            //Test key case insensitivity
            Assert.AreEqual("suit", p["casetest", "my"]);

            //Test section and key case insensitivity
            Assert.AreEqual("suit", p["Casetest", "My"]);
        }
Exemplo n.º 4
0
        public void Defaults()
        {
            Pixini p = new Pixini();

            Assert.AreEqual("chunky", p.Get("Monkey", "animals", "chunky"));
            Assert.AreEqual(string.Empty, p.Get("Monkey", "animals", string.Empty));

            //Test Int
            Assert.AreEqual(783, p.Get("MonkeyAge", "animals", 783));
            Assert.AreEqual(int.MinValue, p.Get("MonkeyAge", "animals", int.MinValue));

            //Test float
            Assert.AreEqual(65.91f, p.Get("MonkeyInjection", "animals", 65.91f));
            Assert.AreEqual(float.NaN, p.Get("MonkeyInjection", "animals", float.NaN));

            //test bool
            Assert.AreEqual(true, p.Get("MonkeyGood", "animals", true));
            Assert.AreEqual(false, p.Get<bool>("MonkeyGood", "animals"));
        }
Exemplo n.º 5
0
        public void TestKeyValueDelete()
        {
            Pixini p = new Pixini();

            p.Set("Case", "My", "suit");
            p.Set("ShirtColor", "My", "red");

            Assert.AreEqual("red", p.Get<string>("ShirtColor", "My"));
            Assert.AreEqual("suit", p["Case", "My"]);

            p.Delete("ShirtColor", "my");
            Assert.AreEqual<string>(null, p["ShirtColor", "My"]);

            //Test a failed delete
            Assert.AreEqual<bool>(false, p.Delete("NonExitentKey", "My"));
        }
Exemplo n.º 6
0
        public void StringSetGet()
        {
            Pixini p = new Pixini();

            p.Set("Case","My", "suit");

            Assert.AreEqual("suit", p.Get("Case", "My", ""));
            Assert.AreEqual("suit", p["Case", "My"]);
        }
Exemplo n.º 7
0
        public void IntegerSetGet()
        {
            Pixini p = new Pixini();

            p.Set("Integer", "My", 45);

            Assert.AreEqual(45, p.Get("Integer", "My", 0));
        }