public void Add() { Tree testTree = new Tree(); Assert.IsFalse(testTree.IsExists(1)); testTree.Add(1); Assert.IsTrue(testTree.IsExists(1)); }
public void Del() { Tree testTree = new Tree(); testTree.Add(1); testTree.Add(2); testTree.Add(3); testTree.Delete(2); Assert.IsTrue(testTree.IsExists(1)); Assert.IsFalse(testTree.IsExists(2)); Assert.IsTrue(testTree.IsExists(3)); }
public void TestIterator() { Tree testTree = new Tree(); testTree.Add(1); testTree.Add(2); testTree.Add(3); var tmp = 1; foreach (int i in testTree) { Assert.IsTrue(tmp == i); tmp++; } }
/// <summary> /// консруктор итератора /// </summary> /// <param name="collection"></param> public Iterator(Tree collection) { this.list = new List<int>(); InitList(collection.head); listEnumerator = list.GetEnumerator(); }