public void Check_Value_At_Index_2()
        {
            //Arrange
            CustomList <int> customList = new CustomList <int>()
            {
                5, 3
            };
            int index2        = 1;
            int expectedValue = 1;
            int actualValue;

            //Act
            customList.Add(index2);
            actualValue = customList[2];

            //Assert
            Assert.AreEqual(expectedValue, actualValue);
        }
        public void Add_Int_Values_To_Custom_List_Checks_Count()
        {
            //Arrange
            CustomList <int> customList = new CustomList <int>()
            {
                5, 3
            };
            int index2        = 1;
            int expectedValue = 3;
            int actualValue;

            //Act
            customList.Add(index2);
            actualValue = customList.Counter;

            //Assert
            Assert.AreEqual(expectedValue, actualValue);
        }
Beispiel #3
0
        public static void Indexer_FindAnObjectInAList_GetRightObject()
        {
            CustomList <int> test = new CustomList <int>();

            int expected = 8;
            int actual;


            test.Add(1);
            test.Add(2);
            test.Add(3);
            test.Add(4);
            test.Add(5);
            test.Add(6);
            test.Add(7);
            test.Add(8);

            actual = test.Count;
            Assert.AreEqual(expected, actual);
        }
Beispiel #4
0
        public static void Add_AddingItemToFullArray_ItemStillAccepted()
        {
            CustomList <int> test = new CustomList <int>();
            int expected          = 9;
            int actual;

            //act

            test.Add(1);
            test.Add(1);
            test.Add(1);
            test.Add(1);
            test.Add(1);
            test.Add(1);
            test.Add(1);
            test.Add(1);
            test.Add(1);

            actual = test.Count;

            //assert

            Assert.AreEqual(expected, actual);
        }
Beispiel #5
0
        public void Add_Int_To_List_Check_That_Capacity_Changes_If_More_Items_Are_Added_To_List()
        {
            //arrange
            CustomList <int> list = new CustomList <int>();
            int expectedCapacity  = 10;
            int valueToAdd        = 20;

            //act
            list.Add(valueToAdd);
            list.Add(valueToAdd);
            list.Add(valueToAdd);
            list.Add(valueToAdd);
            list.Add(valueToAdd);
            list.Add(valueToAdd);
            int actualCapacity = list.Capacity;

            //assert
            Assert.AreEqual(expectedCapacity, actualCapacity);
        }
Beispiel #6
0
        public void Remove_Item_From_List_Check_That_Capacity_Changes_If_More_Items_Are_Removed()
        {
            //arrange
            CustomList <int> list = new CustomList <int>();
            int expectedCapacity  = 5;

            //act
            list.Add(10);
            list.Add(20);
            list.Add(30);
            list.Add(40);
            list.Add(50);
            list.Add(60);
            list.Remove(60);
            int actualCapacity = list.Capacity;

            //assert
            Assert.AreEqual(expectedCapacity, actualCapacity);
        }