static void ListTest() { SingleLinkedList <ImageNode> imageList = new SingleLinkedList <ImageNode>(); imageList = new SingleLinkedList <ImageNode>(); for (int i = 0; i < 20; i++) { var name = "bild-" + i + ".png"; ImageNode n = new ImageNode(); n.Data = name; imageList.AddLast(n); } Console.WriteLine(imageList); var addFirst = new ImageNode("addFirst.png"); var addAfter = new ImageNode("AddAfter.png"); var addBefore = new ImageNode("AddBefore.png"); imageList.AddFirst(addFirst); imageList.AddAfter(addFirst, addAfter); imageList.AddBefore(addFirst, addBefore); Console.WriteLine(imageList); imageList.Remove(addFirst); Console.WriteLine(imageList); imageList.Remove(addAfter); Console.WriteLine(imageList); imageList.Remove(addBefore); Console.WriteLine(imageList); // }
public void AddAfter_NullNewNodeParam_ThrowsArgumentNullException() { _list.AddLast(4); SingleLinkedListNode <int> selectedNode = _list.Last; SingleLinkedListNode <int> newNode = null; TestDelegate del = () => _list.AddAfter(selectedNode, newNode); Assert.Throws <ArgumentNullException>(del); }