예제 #1
0
 public void Add()
 {
     Tree testTree = new Tree();
     Assert.IsFalse(testTree.IsExists(1));
     testTree.Add(1);
     Assert.IsTrue(testTree.IsExists(1));
 }
예제 #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));
 }
예제 #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++;
     }
 }
예제 #4
0
파일: Tree.cs 프로젝트: elenazab/Homework
 /// <summary>
 /// консруктор итератора
 /// </summary>
 /// <param name="collection"></param>
 public Iterator(Tree collection)
 {
     this.list = new List<int>();
     InitList(collection.head);
     listEnumerator = list.GetEnumerator();
 }