Exemple #1
0
        public void RemoveListDuplicatesSimple()
        {
            ListMaker LMakerRLD = new ListMaker();
            LMakerRLD.Add(new Article("A"));
            LMakerRLD.Add(new Article("B"));
            LMakerRLD.Add(new Article("C"));
            LMakerRLD.Add(new Article("A"));

            LMakerRLD.RemoveListDuplicates();

            Assert.AreEqual(LMakerRLD.Count, 3, "Duplicate removed");
            foreach(Article a in LMakerRLD)
            {
                Assert.AreEqual(a, "A", "Duplicates removed from end of list");
                break;
            }
        }
Exemple #2
0
        public void RemoveListDuplicates10K()
        {
            const int big = 10000;
            ListMaker LMakerLarge = new ListMaker();
            LMakerLarge.Clear();
            for(int i=1; i<big; i++)
                LMakerLarge.Add(new Article(i.ToString()));

            LMakerLarge.Add(new Article("1"));

            Assert.AreEqual(LMakerLarge.Count, big);

            LMakerLarge.RemoveListDuplicates();

            Assert.AreEqual(LMakerLarge.Count, big-1, "Duplicate removed");
            Assert.IsTrue(LMakerLarge.Contains(new Article("1")), "First instance of article retained");
        }