public void RemoveFirstMethod_RemovesTheOnlyItemFromList()
            {
                SimpleLinkedList <string> linkedList = new SimpleLinkedList <string>();

                linkedList.AddFirst("asdf");

                linkedList.RemoveFirst();

                Assert.Null(linkedList.Find("asdf"));
            }
            public void RemoveFirstMethod_SetsThe_FirstProperty_ToTheSecondNodeIfTheItemToBeRemovedIsTheHeadOfTheList()
            {
                SimpleLinkedList <string> linkedList = new SimpleLinkedList <string>();

                linkedList.AddFirst("new Item 1");
                linkedList.AddFirst("new Item 2");

                linkedList.RemoveFirst();

                Assert.Equal("new Item 1", linkedList.First.Item);
            }
            public void RemoveFirstMethod_RemovesTheFirstItemInTheList()
            {
                SimpleLinkedList <string> linkedList = new SimpleLinkedList <string>();

                linkedList.AddFirst("asdf");
                linkedList.AddFirst("qwer");

                linkedList.RemoveFirst();

                Assert.NotEqual("qwer", linkedList.First.Item);
            }
            public void RemoveFirstMethod_DecrementsLengthOfList()
            {
                SimpleLinkedList <string> linkedList = new SimpleLinkedList <string>();
                int expectedCount = 0;

                linkedList.AddFirst("asdf"); expectedCount++;
                linkedList.AddFirst("qwer"); expectedCount++;

                linkedList.RemoveFirst(); expectedCount--;

                Assert.Equal(expectedCount, linkedList.Count);
            }
            public void RemoveFirstMethod_SetsThe_LastProperty_ToNullIfTheItemToBeRemovedIsTheOnlyItemInTheList()
            {
                SimpleLinkedList <string> linkedList = new SimpleLinkedList <string>();

                linkedList.AddLast("new Item 1");

                linkedList.RemoveFirst();

                // acessing linkedList.Last throws exception if the tail of the list is null
                Assert.Throws <InvalidOperationException>(
                    delegate
                {
                    LinkedListNode <string> node = linkedList.Last;
                });
            }
            public void RemoveFirstMethod_SetsThe_LastProperty_ToNullIfTheItemToBeRemovedIsTheOnlyItemInTheList()
            {
                SimpleLinkedList<string> linkedList = new SimpleLinkedList<string>();
                linkedList.AddLast("new Item 1");

                linkedList.RemoveFirst();

                // acessing linkedList.Last throws exception if the tail of the list is null
                Assert.Throws<InvalidOperationException>(
                    delegate
                    {
                        LinkedListNode<string> node = linkedList.Last;
                    });
            }
            public void RemoveFirstMethod_SetsThe_FirstProperty_ToTheSecondNodeIfTheItemToBeRemovedIsTheHeadOfTheList()
            {
                SimpleLinkedList<string> linkedList = new SimpleLinkedList<string>();
                linkedList.AddFirst("new Item 1");
                linkedList.AddFirst("new Item 2");

                linkedList.RemoveFirst();

                Assert.Equal("new Item 1", linkedList.First.Item);
            }
            public void RemoveFirstMethod_RemovesTheOnlyItemFromList()
            {
                SimpleLinkedList<string> linkedList = new SimpleLinkedList<string>();
                linkedList.AddFirst("asdf");

                linkedList.RemoveFirst();

                Assert.Null(linkedList.Find("asdf"));
            }
            public void RemoveFirstMethod_RemovesTheFirstItemInTheList()
            {
                SimpleLinkedList<string> linkedList = new SimpleLinkedList<string>();
                linkedList.AddFirst("asdf");
                linkedList.AddFirst("qwer");

                linkedList.RemoveFirst();

                Assert.NotEqual("qwer", linkedList.First.Item);
            }
            public void RemoveFirstMethod_DecrementsLengthOfList()
            {
                SimpleLinkedList<string> linkedList = new SimpleLinkedList<string>();
                int expectedCount = 0;
                linkedList.AddFirst("asdf"); expectedCount++;
                linkedList.AddFirst("qwer"); expectedCount++;

                linkedList.RemoveFirst(); expectedCount--;

                Assert.Equal(expectedCount, linkedList.Count);
            }