public void RemoveLastMethod_RemovesTheOnlyItemInTheList() { SimpleLinkedList <string> linkedList = new SimpleLinkedList <string>(); linkedList.AddLast("asdf"); linkedList.RemoveLast(); Assert.Null(linkedList.Find("asdf")); }
public void RemoveLastMethod_SetsThe_LastProperty_ToTheSecondToLastNodeIfTheItemToBeRemovedIsTheTailOfTheList() { SimpleLinkedList <string> linkedList = new SimpleLinkedList <string>(); linkedList.AddLast("new Item 1"); linkedList.AddLast("new Item 2"); linkedList.RemoveLast(); Assert.Equal("new Item 1", linkedList.Last.Item); }
public void RemoveLastMethod_RemovesTheLastItemInTheList() { SimpleLinkedList <string> linkedList = new SimpleLinkedList <string>(); linkedList.AddLast("asdf"); linkedList.AddLast("qwer"); linkedList.RemoveLast(); Assert.NotEqual("qwer", linkedList.Last.Item); }
public void RemoveLastMethod_DecrementsLengthOfList() { SimpleLinkedList <string> linkedList = new SimpleLinkedList <string>(); int expectedCount = 0; linkedList.AddFirst("asdf"); expectedCount++; linkedList.AddFirst("qwer"); expectedCount++; linkedList.RemoveLast(); expectedCount--; Assert.Equal(expectedCount, linkedList.Count); }
public void RemoveLastMethod_SetsThe_LastProperty_ToNullIfTheItemToBeRemovedIsTheOnlyItemInTheList() { SimpleLinkedList <string> linkedList = new SimpleLinkedList <string>(); linkedList.AddLast("new Item 1"); linkedList.RemoveLast(); // acessing linkedList.Last throws exception if the tail of the list is null Assert.Throws <InvalidOperationException>( delegate { LinkedListNode <string> node = linkedList.Last; }); }
public void RemoveLastMethod_SetsThe_LastProperty_ToTheSecondToLastNodeIfTheItemToBeRemovedIsTheTailOfTheList() { SimpleLinkedList<string> linkedList = new SimpleLinkedList<string>(); linkedList.AddLast("new Item 1"); linkedList.AddLast("new Item 2"); linkedList.RemoveLast(); Assert.Equal("new Item 1", linkedList.Last.Item); }
public void RemoveLastMethod_SetsThe_LastProperty_ToNullIfTheItemToBeRemovedIsTheOnlyItemInTheList() { SimpleLinkedList<string> linkedList = new SimpleLinkedList<string>(); linkedList.AddLast("new Item 1"); linkedList.RemoveLast(); // acessing linkedList.Last throws exception if the tail of the list is null Assert.Throws<InvalidOperationException>( delegate { LinkedListNode<string> node = linkedList.Last; }); }
public void RemoveLastMethod_RemovesTheOnlyItemInTheList() { SimpleLinkedList<string> linkedList = new SimpleLinkedList<string>(); linkedList.AddLast("asdf"); linkedList.RemoveLast(); Assert.Null(linkedList.Find("asdf")); }
public void RemoveLastMethod_RemovesTheLastItemInTheList() { SimpleLinkedList<string> linkedList = new SimpleLinkedList<string>(); linkedList.AddLast("asdf"); linkedList.AddLast("qwer"); linkedList.RemoveLast(); Assert.NotEqual("qwer", linkedList.Last.Item); }
public void RemoveLastMethod_DecrementsLengthOfList() { SimpleLinkedList<string> linkedList = new SimpleLinkedList<string>(); int expectedCount = 0; linkedList.AddFirst("asdf"); expectedCount++; linkedList.AddFirst("qwer"); expectedCount++; linkedList.RemoveLast(); expectedCount--; Assert.Equal(expectedCount, linkedList.Count); }