Example #1
0
        public void TestRemoveAll()
        {
            ShortList list = new ShortList();

            for (short j = 0; j < 1000; j++)
            {
                list.Add(j);
            }
            ShortList listCopy = new ShortList(list);
            ShortList listOdd = new ShortList();
            ShortList listEven = new ShortList();

            for (short j = 0; j < 1000; j++)
            {
                if (j % 2 == 0)
                {
                    listEven.Add(j);
                }
                else
                {
                    listOdd.Add(j);
                }
            }
            list.RemoveAll(listEven);
            Assert.IsTrue(list.Equals(listOdd));// Assert.AreEqual(list, listOdd);
            list.RemoveAll(listOdd);
            Assert.IsTrue(list.IsEmpty());
            listCopy.RemoveAll(listOdd);
            //Assert.AreEqual(listCopy, listEven);
            Assert.IsTrue(listCopy.Equals(listEven));
            listCopy.RemoveAll(listEven);
            Assert.IsTrue(listCopy.IsEmpty());
        }