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 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 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); }