Esempio n. 1
0
        public void InsertMethodOutOfBoundsException()
        {
            var testList = new ListCollection <int>();

            int[] testArray = new int[4];
            Assert.Throws <ArgumentOutOfRangeException>(() => testList.Insert(-3, 4));
        }
Esempio n. 2
0
        public void InsertMethodIsReadonlyException()
        {
            var testList = new ListCollection <int> {
                1, 2
            };

            testList = testList.ReadOnlyList();
            Assert.Throws <NotSupportedException>(() => testList.Insert(1, 2));
        }
Esempio n. 3
0
        public void ValidatesInsertMethod()
        {
            var test = new ListCollection <int>();

            test.Add(5);
            test.Add(3);
            test.Insert(0, 1);
            Assert.Equal(1, test[0]);
            Assert.Equal(5, test[1]);
            Assert.Equal(3, test[2]);
            Assert.Equal(3, test.Count);
        }