Пример #1
0
        public void RemoveItemsAtInvalidIndex()
        {
            var list = new ListHistory <string>
            {
                "a",
                "b",
                "c",
                "d",
                "e",
                "f",
            };

            Assert.Throws <ArgumentOutOfRangeException>(() => list.RemoveAt(-1));
            Assert.Throws <ArgumentOutOfRangeException>(() => list.RemoveAt(list.Count));
        }
Пример #2
0
        public void RemoveItemsAt()
        {
            var list = new ListHistory <string>
            {
                "a",
                "b",
                "c",
                "d",
                "e",
                "f",
            };

            list.RemoveAt(3);
            Assert.IsFalse(list.Contains("d"));

            list.RemoveAt(3);
            Assert.IsFalse(list.Contains("e"));

            list.RemoveAt(3);
            Assert.IsFalse(list.Contains("f"));

            list.RemoveAt(2);
            Assert.IsFalse(list.Contains("c"));

            list.RemoveAt(1);
            Assert.IsFalse(list.Contains("b"));

            list.RemoveAt(0);
            Assert.IsFalse(list.Contains("a"));
        }