Example #1
0
 public void Add()
 {
     Tree testTree = new Tree();
     Assert.IsFalse(testTree.IsExists(1));
     testTree.Add(1);
     Assert.IsTrue(testTree.IsExists(1));
 }
Example #2
0
 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));
 }
Example #3
0
 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++;
     }
 }
Example #4
0
 /// <summary>
 /// консруктор итератора
 /// </summary>
 /// <param name="collection"></param>
 public Iterator(Tree collection)
 {
     this.list = new List<int>();
     InitList(collection.head);
     listEnumerator = list.GetEnumerator();
 }