Пример #1
0
        public void AddFiveElementsAssertCountFive()
        {
            var arrayList = new ArrayLists <int>();

            for (int i = 0; i < 5; i++)
            {
                arrayList.Add(i);
            }

            Assert.AreEqual(5, arrayList.Count);
        }
Пример #2
0
        public void AddFourItemsAssertItemIsPresentAndNonAddedItemIsNotPresent()
        {
            var arrayList = new ArrayLists <int>();

            for (int i = 0; i < 4; i++)
            {
                arrayList.Add(i);
            }

            Assert.IsTrue(arrayList.Contains(1));

            Assert.IsFalse(arrayList.Contains(5));
        }
Пример #3
0
        public void AddFiveElementsThenClearAssertInitialSizeAndSizeZero()
        {
            var arrayList = new ArrayLists <int>();

            for (int i = 0; i < 5; i++)
            {
                arrayList.Add(i);
            }

            arrayList.Clear();

            Assert.AreEqual(4, arrayList.InitialSize);
            Assert.AreEqual(0, arrayList.Count);
        }
Пример #4
0
        public void AddFiveElementsAssertElementsAddedInOrder()
        {
            var arrayList = new ArrayLists <int>();

            for (int i = 0; i < 5; i++)
            {
                arrayList.Add(i);
            }

            for (int i = 0; i < 5; i++)
            {
                Assert.AreEqual(i, arrayList[i]);
            }
        }
Пример #5
0
        public void AddSixteenItems_RemoveNineItems_AssertCorrectBehaviourOfResize()
        {
            var arrayList = new ArrayLists <int>();

            for (int i = 0; i < 16; i++)
            {
                arrayList.Add(i);
            }

            for (int k = 15; k > 6; k--)
            {
                arrayList.RemoveAt(k);
            }

            Assert.AreEqual(7, arrayList.Count);
        }
Пример #6
0
        public void AddFiveElementsTestForEnumeration()
        {
            var arrayList = new ArrayLists <int>();

            for (int i = 0; i < 5; i++)
            {
                arrayList.Add(i);
            }

            var j = 0;

            foreach (var item in arrayList)
            {
                Assert.AreEqual(j, item);
                j++;
            }
        }
Пример #7
0
        public void AddFourItemsInsertItemAtIndexZero()
        {
            var arrayList = new ArrayLists <int>();

            for (int i = 0; i < 4; i++)
            {
                arrayList.Add(i);
            }

            arrayList.Insert(0, 100);
            Assert.IsTrue(arrayList.Contains(100));
            Assert.AreEqual(100, arrayList[0]);

            var j = 0;

            for (int i = 1; i < 5; i++)
            {
                Assert.AreEqual(j, arrayList[i]);
                j++;
            }
        }