示例#1
0
        public void Count_1Point()
        {
            IIntegerList list = new IntegerList();

            Assert.AreEqual(0, list.Count);

            list.Add(1);
            list.Add(2);
            list.Add(3);
            Assert.AreEqual(3, list.Count);

            list.Remove(3);
            list.Remove(2);
            Assert.AreEqual(1, list.Count);
        }
示例#2
0
        public void RemoveFromList_1Point()
        {
            IIntegerList list = new IntegerList();

            list.Add(11);
            list.Add(2);
            list.Add(11);

            Assert.AreEqual(false, list.Remove(10));
            Assert.AreEqual(3, list.Count);

            // will remove only first occurence
            Assert.AreEqual(true, list.Remove(11));
            Assert.AreEqual(11, list.GetElement(1));
            Assert.AreEqual(2, list.GetElement(0));
        }