Ejemplo n.º 1
0
        protected override void Store()
        {
            IntItem item = IntItem.NewIntItem(DEPTH);

            item._isRoot = true;
            Store(item);
        }
Ejemplo n.º 2
0
        public static IntItem NewIntItem(int depth)
        {
            if (depth == 0)
            {
                return null;
            }

            IntItem root = new IntItem();
            root._intValue = depth;
            root._next = NewIntItem(depth - 1);
            return root;
        }
Ejemplo n.º 3
0
        public static IntItem NewIntItem(int depth)
        {
            if (depth == 0)
            {
                return(null);
            }

            IntItem root = new IntItem();

            root._intValue = depth;
            root._next     = NewIntItem(depth - 1);
            return(root);
        }
Ejemplo n.º 4
0
        public void Test()
        {
            IntItem item = RetrieveRoot();

            Assert.IsNotNull(item);

            for (int i = 0; i < DEPTH - 1; i++)
            {
                Assert.AreEqual(0, GetField(item, "_intValue"));
                Assert.IsNull(GetField(item, "_next"));
                Assert.AreEqual(DEPTH - i, item.GetIntValue());
                Assert.IsNotNull(item.Next());
                Assert.AreEqual(DEPTH - i, GetField(item, "_intValue"));
                Assert.IsNotNull(GetField(item, "_next"));
                item = item.Next();
            }

            Assert.AreEqual(0, GetField(item, "_intValue"));
            Assert.IsNull(GetField(item, "_next"));
            Assert.AreEqual(1, item.GetIntValue());
            Assert.IsNull(GetField(item, "_next"));
        }