Ejemplo n.º 1
0
        public void writeGenericChecked()
        {
            string    path = tmpFile("write.generic.checked");
            SkillFile sf   = SkillFile.open(path);

            reflectiveInit(sf);
            // write file
            sf.flush();

            // create a name -> type map
            Dictionary <string, IAccess> types = new Dictionary <string, IAccess>();

            foreach (IAccess t in sf.allTypes())
            {
                types[t.Name] = t;
            }

            // read file and check skill IDs
            SkillFile sf2 = SkillFile.open(path, Mode.Read);

            foreach (IAccess t in sf2.allTypes())
            {
                IEnumerator os = types[t.Name].GetEnumerator();
                foreach (SkillObject o in t)
                {
                    Assert.IsTrue(os.MoveNext(), "to few instances in read state");
                    Assert.AreEqual(o.SkillID, ((SkillObject)os.Current).SkillID);
                }
                Assert.IsFalse(os.MoveNext(), "to many instances in read state");
            }
            File.Delete(path);
        }
Ejemplo n.º 2
0
        public void writeGeneric()
        {
            string    path = tmpFile("write.generic");
            SkillFile sf   = SkillFile.open(path);

            reflectiveInit(sf);
            sf.close();
            File.Delete(path);
        }
Ejemplo n.º 3
0
        public void APITest_core_annotation_acc_Znull()
        {
            string    path = tmpFile("null");
            SkillFile sf   = SkillFile.open(path, Mode.Create, Mode.Write);

            // create objects
            annotation.Test tst = (annotation.Test)sf.Tests().make();
            // set fields
            tst.f = ([email protected])null;
            sf.close();

            { // read back and assert correctness
                SkillFile sf2 = SkillFile.open(sf.currentPath(), Mode.Read, Mode.ReadOnly);
                // check count per Type
                Assert.AreEqual(1, sf.Tests().staticSize());
                // create objects from file
                annotation.Test tst_2 = (annotation.Test)sf2.Tests().getByID(tst.SkillID);
                // assert fields
                Assert.IsTrue(tst_2.f == null);
            }
            File.Delete(path);
        }
Ejemplo n.º 4
0
 public SkillFile read(string s)
 {
     return(SkillFile.open(basePath + s, Mode.Read, Mode.ReadOnly));
 }