public void AtListWithOneElementFindReturnExistElementAnotherReturnNull()
        {
            var list = new KLList();

            list.Add("fred");

            Assert.AreEqual("fred", list.Find ("fred").Value);
            Assert.IsNull(list.Find("wilma"));
        }
        public void AtListWithALotElementsExecuteValuesReturnArrayElements()
        {
            var list = new KLList();

            list.Add("fred");
            list.Add("wilma");
            list.Add("betty");
            list.Add("barney");

            Assert.AreEqual(new[] {"fred", "wilma", "betty", "barney"}, list.Values());
        }
        public void AtListExecuteValuesReturnArrayElements()
        {
            var list = new KLList();

            list.Add("fred");
            list.Add("wilma");

            Assert.AreEqual("fred", list.Find ("fred").Value);
            Assert.AreEqual("wilma", list.Find ("wilma").Value);
            Assert.AreEqual(new[] {"fred", "wilma"}, list.Values());
        }
        public void DeleteNodeNullThrowAssert()
        {
            var list = new KLList();

            list.Add("fred");
            list.Add("wilma");
            list.Add("betty");
            list.Add("barney");

            Assert.Throws<NullReferenceException>(() => list.Delete(null));

            Assert.AreEqual(new[] {"fred", "wilma", "betty", "barney"}, list.Values());
        }
        public void DeleteAllNodes()
        {
            var list = new KLList();

            list.Add("fred");
            list.Add("wilma");
            list.Add("betty");
            list.Add("barney");

            list.Delete(list.Find("wilma"));
            list.Delete(list.Find("barney"));
            list.Delete(list.Find("fred"));
            list.Delete(list.Find("betty"));

            Assert.AreEqual(new string[] { }, list.Values());
        }
        public void DeleteNodesWilmaAndBarney()
        {
            var list = new KLList();

            list.Add("fred");
            list.Add("wilma");
            list.Add("betty");
            list.Add("barney");

            list.Delete(list.Find("wilma"));
            list.Delete(list.Find("barney"));

            Assert.AreEqual(new[] {"fred", "betty"}, list.Values());
        }
        public void NodeFredWithoutLinked()
        {
            var list = new KLList();

            list.Add("fred");

            Assert.AreEqual("fred", list.Find ("fred").Value);
            Assert.IsNull(list.Find("fred").Next);
        }
        public void NodeFredLinkedWithNodeWilmaAndWilmaLinkedWithBettyAndBettyWithoutLinked()
        {
            var list = new KLList();

            list.Add("fred");
            list.Add("wilma");
            list.Add("betty");

            Assert.AreEqual("wilma", list.Find("fred").Next.Value);
            Assert.AreEqual("betty", list.Find("wilma").Next.Value);
            Assert.IsNull(list.Find("betty").Next);
        }
        public void AfterDeleteNodeWilmaNodeFredLinkedWithNodeBetty()
        {
            var list = new KLList();

            list.Add("fred");
            list.Add("wilma");
            list.Add("betty");

            list.Delete(list.Find("wilma"));

            Assert.AreEqual("betty", list.Find("fred").Next.Value);
            Assert.IsNull(list.Find("betty").Next);
        }
        public void AtEmptyListFindReturnNull()
        {
            var list = new KLList();

            Assert.IsNull(list.Find("fred"));
        }