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 TestInvalidCompareTo() { VisitableLinkedList <string> l = new VisitableLinkedList <string>(); l.CompareTo(null); }