Exemplo n.º 1
0
        public void fullShiftRightTest()
        {
            Oid id;
            int ct = 0;

            using (SessionNoServer session = new SessionNoServer(systemDir))
            {
                session.BeginUpdate();
                BTreeSet <int> bTree = new BTreeSet <int>(null, session, 9);
                session.Persist(bTree);
                id = bTree.Oid;
                for (int i = 65; i >= 0; i -= 5)
                {
                    bTree.Add(i);
                    ct++;
                }
                bTree.Remove(65);
                ct--;
                bTree.Remove(60);
                ct--;
                bTree.Remove(55);
                ct--;
                bTree.Remove(50);
                ct--;
                bTree.Add(1);
                ct++;
                bTree.Add(2);
                ct++;
                bTree.Add(3);
                ct++;
                bTree.Add(4);
                ct++;
                session.Commit();
            }
            using (SessionNoServer session = new SessionNoServer(systemDir))
            {
                session.BeginRead();
                BTreeSet <int> bTree = (BTreeSet <int>)session.Open(id);
                int            count = 0;
                foreach (int num in bTree)
                {
                    count++;
                }
                Assert.True(ct == bTree.Count);
                Assert.True(ct == bTree.Count());
                session.Commit();
            }
        }