public void TestAddBeforeAndAfterRemoveFirst() { IterableLinkedList <string> list = new IterableLinkedList <string>(); list.AddLast("2"); list.AddAfter("2", "3"); list.AddBefore("2", "1"); string value; Assert.IsTrue(list.RemoveFirst(out value)); Assert.AreEqual("1", value); Assert.IsTrue(list.RemoveFirst(out value)); Assert.AreEqual("2", value); Assert.IsTrue(list.RemoveFirst(out value)); Assert.AreEqual("3", value); }
public void TestRemove() { IterableLinkedList <string> list = new IterableLinkedList <string>(); for (int i = 0; i < 50; i++) { list.AddLast("" + i); } Assert.IsTrue(list.Remove("35")); string value; for (int i = 0; i < 49; i++) { Assert.IsTrue(list.RemoveFirst(out value)); } Assert.IsFalse(list.RemoveFirst(out value)); }