예제 #1
0
        public void Test_Common()
        {
            GDMTag obj1 = new GDMTag();
            GDMTag obj2 = new GDMTag();

            using (var list = new GDMList <GDMTag>()) {
                // internal list is null (all routines instant returned)
                list.Delete(null);
                list.Exchange(0, 1);
                Assert.IsNull(list.Extract(0));
                Assert.IsNull(list.Extract(null));

                // normal checks
                list.Add(obj1);
                list.Add(obj2);
                Assert.AreEqual(0, list.IndexOf(obj1));
                Assert.AreEqual(1, list.IndexOf(obj2));

                using (var list2 = new GDMList <GDMTag>()) {
                    list2.AddRange(list);
                    Assert.AreEqual(2, list2.Count);
                }

                list.Delete(obj1);
                Assert.AreEqual(-1, list.IndexOf(obj1));
                Assert.AreEqual(0, list.IndexOf(obj2));

                list.Add(obj1);
                Assert.AreEqual(1, list.IndexOf(obj1));
                Assert.AreEqual(0, list.IndexOf(obj2));
                list.Exchange(0, 1);
                Assert.AreEqual(0, list.IndexOf(obj1));
                Assert.AreEqual(1, list.IndexOf(obj2));

                Assert.AreEqual(null, list.Extract(null));
                list.Add(obj1);
                Assert.AreEqual(obj1, list.Extract(obj1));
            }
        }
예제 #2
0
        public void Test_Common()
        {
            GDMTag obj1 = new GDMTag(null);
            GDMTag obj2 = new GDMTag(null);

            using (GDMList <GDMTag> list = new GDMList <GDMTag>(null)) {
                // internal list is null (all routines instant returned)
                list.Delete(null);
                list.Exchange(0, 1);
                Assert.IsNull(list.Extract(0));
                Assert.IsNull(list.Extract(null));

                // normal checks
                list.Add(obj1);
                list.Add(obj2);
                Assert.AreEqual(0, list.IndexOf(obj1));
                Assert.AreEqual(1, list.IndexOf(obj2));

                list.Delete(obj1);
                Assert.AreEqual(-1, list.IndexOf(obj1));
                Assert.AreEqual(0, list.IndexOf(obj2));

                list.Add(obj1);
                Assert.AreEqual(1, list.IndexOf(obj1));
                Assert.AreEqual(0, list.IndexOf(obj2));
                list.Exchange(0, 1);
                Assert.AreEqual(0, list.IndexOf(obj1));
                Assert.AreEqual(1, list.IndexOf(obj2));

                Assert.AreEqual(null, list.Extract(null));
                list.Add(obj1);
                Assert.AreEqual(obj1, list.Extract(obj1));

                foreach (GDMObject obj in list)
                {
                }
            }
        }
예제 #3
0
        public void RemoveRepository(GDMRepositoryRecord repRec)
        {
            if (repRec == null)
            {
                throw new ArgumentNullException("repRec");
            }

            foreach (GDMRepositoryCitation repCit in fRepositoryCitations)
            {
                if (repCit.XRef == repRec.XRef)
                {
                    fRepositoryCitations.Delete(repCit);
                    break;
                }
            }
        }
예제 #4
0
파일: GDMTree.cs 프로젝트: chipsi/gedkeeper
 public void DeleteRecord(GDMRecord record)
 {
     XRefIndex_DeleteRecord(record);
     fRecords.Delete(record);
 }