public void TestRetainAll() { IntList list = new IntList(); for (int j = 0; j < 1000; j++) { list.Add(j); } IntList listCopy = new IntList(list); IntList listOdd = new IntList(); IntList listEven = new IntList(); for (int j = 0; j < 1000; j++) { if (j % 2 == 0) { listEven.Add(j); } else { listOdd.Add(j); } } list.RetainAll(listOdd); //Assert.AreEqual(list, listOdd); Assert.IsTrue(list.Equals(listOdd)); list.RetainAll(listEven); Assert.IsTrue(list.IsEmpty()); listCopy.RetainAll(listEven); //Assert.AreEqual(listCopy, listEven); Assert.IsTrue(listCopy.Equals(listEven)); listCopy.RetainAll(listOdd); Assert.IsTrue(listCopy.IsEmpty()); }