protected override void Store() { IntItem item = IntItem.NewIntItem(DEPTH); item._isRoot = true; Store(item); }
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; }
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); }
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")); }