Example #1
0
        public void RemoveIntFromList_CheckLastIndex()
        {
            //Arrange
            CustomLists <int> myList = new CustomLists <int>();
            int value  = 5;
            int value2 = 10;
            int value3 = 20;
            int value4 = 15;
            int value5 = 60;

            int expected = 60;

            //Act
            myList.Add(value);
            myList.Add(value2);
            myList.Add(value3);
            myList.Add(value4);
            myList.Add(value5);


            myList.Remove(myList[2]);

            int actual = myList[3];

            //Assert
            Assert.AreEqual(expected, actual);
        }
        public void Add_SevenNumbers_Remove_TwoNumbers_CheckIndexThree()
        {
            //Arrange
            CustomLists <int> listAdd7CheckIndex3 = new CustomLists <int>();
            int expected = 6;
            int actual;

            //Act
            listAdd7CheckIndex3.Add(1);
            listAdd7CheckIndex3.Add(2);
            listAdd7CheckIndex3.Add(3);
            listAdd7CheckIndex3.Add(4);
            listAdd7CheckIndex3.Add(5);
            listAdd7CheckIndex3.Add(6);
            listAdd7CheckIndex3.Add(7);
            listAdd7CheckIndex3.Remove(1);
            listAdd7CheckIndex3.Remove(2);

            actual = listAdd7CheckIndex3[3];
            //Assert
            Assert.AreEqual(expected, actual);
        }
        public void Add_Number_Remove_Number_CheckIndexZero()
        {
            //Arrange
            CustomLists <int> listAddRemove = new CustomLists <int>();
            int expected = 0;
            int actual;

            //Act
            listAddRemove.Add(1);
            listAddRemove.Remove(1);

            actual = listAddRemove.Count;
            //Assert
            Assert.AreEqual(expected, actual);
        }
        public void Remove_Item_ThatDoesntExist()
        {
            //Arrange
            CustomLists <bool> listRemoveFakeNumber = new CustomLists <bool>();
            bool expected = false;
            bool actual;

            //Act
            listRemoveFakeNumber.Remove(true);

            actual = false;

            //Assert
            Assert.AreEqual(expected, actual);
        }
        public void Add_SevenNumbers_RemoveTwoNumbers_CheckCount()
        {
            //Arrange
            CustomLists <int> listAdd7Count = new CustomLists <int>();
            int expected = 5;
            int actual;


            //Act
            listAdd7Count.Add(1);
            listAdd7Count.Add(2);
            listAdd7Count.Add(3);
            listAdd7Count.Add(4);
            listAdd7Count.Add(5);
            listAdd7Count.Add(6);
            listAdd7Count.Add(7);
            listAdd7Count.Remove(4);
            listAdd7Count.Remove(5);

            actual = listAdd7Count.Count;

            //Assert
            Assert.AreEqual(expected, actual);
        }
        public void AddTwoStrings_RemoveString()
        {
            //Arrange
            CustomLists <string> listAddRemoveString = new CustomLists <string>();
            string expected = "Coding";
            string actual;

            //Act
            listAddRemoveString.Add("Computer");
            listAddRemoveString.Add("Coding");
            listAddRemoveString.Remove("Computer");

            actual = listAddRemoveString.ToString();
            //Assert
            Assert.AreEqual(expected, actual);
        }
Example #7
0
        public void removeElement_CheckCounter()
        {
            //Arrange
            CustomLists <int> nums = new CustomLists <int>()
            {
                1, 2, 3
            };
            int actual;
            int expected = 2;

            //Act
            nums.Remove(2);
            actual = nums.Count;
            //Assert
            Assert.AreEqual(actual, expected);
        }
Example #8
0
        public void removeElement_CheckElementIsRemoved_Int()
        {
            //Arrange
            CustomLists <int> nums = new CustomLists <int>();

            nums.Add(1);
            nums.Add(2);
            nums.Add(3);
            int removeInt = 2;
            int actual;
            int expected = 3;

            //Act
            nums.Remove(removeInt);
            actual = nums[1];
            //Assert
            Assert.AreEqual(actual, expected);
        }
        public void Add_ThreeNumbers_RemoveIndexTwo()
        {
            //Arrange
            CustomLists <int> listRemoveIndex2 = new CustomLists <int>();
            int expected = 2;
            int actual;


            //Act
            listRemoveIndex2.Add(1);
            listRemoveIndex2.Add(2);
            listRemoveIndex2.Add(3);
            listRemoveIndex2.Remove(3);

            actual = listRemoveIndex2.Count;

            //Assert
            Assert.AreEqual(expected, actual);
        }
Example #10
0
        public void removeElement_CheckIfAllElementsAreRemoved_Int()
        {
            //Arrange
            CustomLists <int> nums = new CustomLists <int>();

            nums.Add(1);
            nums.Add(4);
            nums.Add(3);
            nums.Add(4);
            int removeInt = 4;
            int actual;
            int expected = 4;

            //Act
            nums.Remove(removeInt);
            actual = nums[2];
            //Assert
            Assert.AreEqual(actual, expected);
        }
Example #11
0
        public void RemoveIntFromList()
        {
            //Arrange
            CustomLists <int> myList = new CustomLists <int>();
            int value    = 5;
            int value2   = 10;
            int value3   = 20;
            int expected = 20;

            //Act
            myList.Add(value);
            myList.Add(value2);
            myList.Add(value3);

            myList.Remove(value2);

            int actual = myList[1];

            //Assert
            Assert.AreEqual(expected, actual);
        }
Example #12
0
        public void RemoveStringFromList_CheckCount()
        {
            //Arrange
            CustomLists <string> myList = new CustomLists <string>();

            myList.Add("What");
            myList.Add("color");
            myList.Add("are");
            myList.Add("your");
            myList.Add("shoes?");
            myList.Add(".");

            int expected = 5;

            myList.Remove("your");
            //Act

            int actual = myList.Count;

            //Assert
            Assert.AreEqual(expected, actual);
        }
Example #13
0
        public void RemoveStringFromList()
        {
            //Arrange
            CustomLists <string> myList = new CustomLists <string>();

            myList.Add("What");
            myList.Add("color");
            myList.Add("are");
            myList.Add("your");
            myList.Add("shoes?");
            myList.Add(".");

            string expected = "are";

            myList.Remove("your");
            //Act

            string actual = myList[2];

            //Assert
            Assert.AreEqual(expected, actual);
        }
Example #14
0
        public void RemoveObjectsFromList()
        {
            //Arrange

            CustomLists <TesterObjects> myList = new CustomLists <TesterObjects>();

            myList.Add(new TesterObjects("Todd", 12));
            myList.Add(new TesterObjects("John", 15));
            myList.Add(new TesterObjects("Bob", 17));
            myList.Add(new TesterObjects("Steve", 26));

            int expected = 3;

            //Act

            myList.Remove(myList[0]);

            //Assert

            int actual = myList.Count;

            Assert.AreEqual(expected, actual);
        }