public void TestCompareTo() { VisitableLinkedList <int> l1 = new VisitableLinkedList <int>(); l1.AddFirst(5); VisitableLinkedList <int> l2 = new VisitableLinkedList <int>(); l2.AddFirst(3); l2.AddFirst(4); Assert.AreEqual(l1.CompareTo(l2), -1); Assert.AreEqual(l2.CompareTo(l1), 1); Assert.AreEqual(l1.CompareTo(l1), 0); object o = new object(); Assert.AreEqual(l1.CompareTo(o), -1); }
public void TestAddFirstFullList() { VisitableLinkedList <int> testList = GetTestCustomLinkedList(); testList.AddFirst(15); Assert.AreEqual(testList.First.Value, 15); Assert.AreNotEqual(testList.First.Next, null); Assert.AreEqual(testList.First.Next.Value, 0); }
public void TestFixedSize() { VisitableLinkedList <int> l = new VisitableLinkedList <int>(); Assert.AreEqual(l.IsFixedSize, false); l = new VisitableLinkedList <int>(); l.AddFirst(4); Assert.AreEqual(l.IsFixedSize, false); }
public void TestAddFirstEmptyList() { VisitableLinkedList <int> testList = new VisitableLinkedList <int>(); testList.AddFirst(16); Assert.AreNotEqual(testList.First, null); Assert.AreEqual(testList.First.Value, 16); Assert.AreNotEqual(testList.Last, null); Assert.AreEqual(testList.Last.Value, 16); Assert.AreEqual(testList.First.Next, null); }