// TODO: The following produces a stack overflow. That's OK for now, peekPersisted is rarely
        //		 used and users can control behaviour with the depth parameter.
        //
        //		LinkedList peeked = (LinkedList) db().ext().peekPersisted(head, Integer.MAX_VALUE, true);
        //		assertListIsComplete(peeked);
        private void AssertListIsComplete(LongLinkedListTestCase.LinkedList head)
        {
            int count = 1;

            LongLinkedListTestCase.LinkedList tail = head._next;
            while (tail != head)
            {
                count++;
                tail = tail._next;
            }
            Assert.AreEqual(Count, count);
        }
 private static LongLinkedListTestCase.LinkedList NewLongCircularList()
 {
     LongLinkedListTestCase.LinkedList head = new LongLinkedListTestCase.LinkedList();
     LongLinkedListTestCase.LinkedList tail = head;
     for (int i = 1; i < Count; i++)
     {
         tail._next  = new LongLinkedListTestCase.LinkedList();
         tail        = tail._next;
         tail._depth = i;
     }
     tail._next = head;
     return(head);
 }
示例#3
0
		private static LongLinkedListTestCase.LinkedList NewLongCircularList()
		{
			LongLinkedListTestCase.LinkedList head = new LongLinkedListTestCase.LinkedList();
			LongLinkedListTestCase.LinkedList tail = head;
			for (int i = 1; i < Count; i++)
			{
				tail._next = new LongLinkedListTestCase.LinkedList();
				tail = tail._next;
				tail._depth = i;
			}
			tail._next = head;
			return head;
		}
        public virtual void Test()
        {
            IQuery q = NewQuery(typeof(LongLinkedListTestCase.LinkedList));

            q.Descend("_depth").Constrain(0);
            IObjectSet objectSet = q.Execute();

            Assert.AreEqual(1, objectSet.Count);
            LongLinkedListTestCase.LinkedList head = (LongLinkedListTestCase.LinkedList)objectSet
                                                     .Next();
            Db().Activate(head, int.MaxValue);
            AssertListIsComplete(head);
            Db().Deactivate(head, int.MaxValue);
            Db().Activate(head, int.MaxValue);
            AssertListIsComplete(head);
            Db().Deactivate(head, int.MaxValue);
            Db().Refresh(head, int.MaxValue);
            AssertListIsComplete(head);
        }