public void Insert() { LinkedList ll = new LinkedList(); ll.Add("item1"); ll.Add("item2"); ll.Insert(1, "item1andahalf"); Assert.IsTrue(ll.Count == 3, "Expected 3 items not " + ll.Count); Assert.IsTrue(ll[0].Equals("item1"), "Expected first element to be \"item1\" not " + ll[0]); Assert.IsTrue(ll[1].Equals("item1andahalf"), "Expected second element to be \"item1andahalf\" not " + ll[1]); Assert.IsTrue(ll[2].Equals("item2"), "Expected third element to be \"item2\" not " + ll[0]); }
public void Insert() { LinkedList ll = new LinkedList(); ll.Add("item1"); ll.Add("item2"); ll.Insert(1, "item1andahalf"); Assert.IsTrue(ll.Count == 3, "Expected 3 items not " + ll.Count); Assert.IsTrue(ll[0].Equals("item1"), "Expected first element to be \"item1\" not " + ll[0]); Assert.IsTrue(ll[1].Equals("item1andahalf"), "Expected second element to be \"item1andahalf\" not " + ll[1]); Assert.IsTrue(ll[2].Equals("item2"), "Expected third element to be \"item2\" not " + ll[0]); }