Ejemplo n.º 1
0
 public void ReadArray()
 {
     using (Settings stg = new Settings(Process.GetCurrentProcess().ProcessName + ".ini", Settings.Format.IniFormat))
     {
         stg.BeginGroup("TestLoader");
         stg.BeginReadArray("AnotherArray");
         stg.SetArrayIndex(1);
         Assert.AreEqual(">UnitTests.Plugin.PluginForSpecificArrayTest", stg.Value(""));
         stg.SetArrayIndex(0);
         Assert.AreEqual("OKMANY2", stg.Value("Param"));
     }
 }
Ejemplo n.º 2
0
        public void Structure()
        {
            using (Settings stg = new Settings(Process.GetCurrentProcess().ProcessName + ".ini", Settings.Format.IniFormat))
            {
                string[] keys = stg.AllKeys();
                Assert.AreEqual(24, keys.Length);
                Assert.AreEqual("TestSection/Param", keys[1]);

                string[] chd = stg.ChildKeys();
                Assert.AreEqual(0, chd.Length);

                string[] grp = stg.ChildGroups();
                Assert.AreEqual(4, grp.Length);
                Assert.AreEqual("TestLoader", grp[1]);

                stg.BeginGroup("TestSection");

                keys = stg.AllKeys();
                Assert.AreEqual(12, keys.Length);
                Assert.AreEqual("Param", keys[1]);

                chd = stg.ChildKeys();
                Assert.AreEqual(8, chd.Length);
                Assert.AreEqual("Param", keys[1]);

                grp = stg.ChildGroups();
                Assert.AreEqual(2, grp.Length);
                Assert.AreEqual("Many", grp[1]);

                int size = stg.BeginReadArray("Many");
                Assert.AreEqual(1, size);
                
                stg.SetArrayIndex(0);
                
                Assert.AreEqual("OKMANY1", stg.Value("Param"));
                stg.EndGroup();
            }

        }