public void TestClearMethod() { var linkedList = new DoubleLinkedList<int>(); linkedList.AddFirst(3); linkedList.AddLast(2); linkedList.AddAfter(linkedList.First, 1); linkedList.AddBefore(linkedList.Last, 3); linkedList.Clear(); Assert.AreEqual(0, linkedList.Count); Assert.IsNull(linkedList.First); Assert.IsNull(linkedList.Last); }
public void TestAddAfterMethod() { var linkedList = new DoubleLinkedList<int>(); linkedList.AddFirst(4); linkedList.AddFirst(1); linkedList.AddAfter(linkedList.First, 2); linkedList.AddAfter(linkedList.Last, 5); linkedList.AddAfter(linkedList.Find(2), 3); CollectionAssert.AreEqual(new List<int> { 1, 2, 3, 4, 5 }, linkedList.ToList()); }