Esempio n. 1
0
        public void RemoveFromList_IfIndexRemoved_ListOneCountLess()
        {
            //Arrange
            BriansList <int> list = new BriansList <int>();

            list.Add(1);
            list.Add(2);
            list.Add(3);
            list.Add(4);
            int expected = 3;

            //Act
            list.Remove(2);
            int actual = list.Count;

            //Assert
            Assert.AreEqual(expected, actual);
        }
Esempio n. 2
0
        public void RemoveFromList_IfRemovingNothing_SameListReturns()
        {
            //Arrange
            BriansList <int> list = new BriansList <int>();

            list.Add(1);
            list.Add(2);
            list.Add(3);
            list.Add(4);
            int expected = 4;

            //Act
            list.Remove(0); //as in, no zero value to find
            int actual = list.Count;

            //Assert
            Assert.AreEqual(expected, actual);
        }
Esempio n. 3
0
        public void RemoveFromList_IfRemoveSameNumber_AllInstancesRemoved()
        {
            //Arrange
            BriansList <int> list = new BriansList <int>();

            list.Add(1);
            list.Add(2);
            list.Add(1);
            list.Add(1);

            int expected = 3;

            //Act
            list.Remove(1);
            int actual = list.Count;

            //Assert
            Assert.AreEqual(expected, actual);
        }
Esempio n. 4
0
        public void RemoveFromList_IfIndexReferenced_MakeSureIndexRemoved()
        {
            //Arrange
            BriansList <int> list = new BriansList <int>();

            list.Add(1);
            list.Add(2);
            list.Add(3);
            list.Add(4);

            int expected = 4;

            //Act
            list.Remove(3);
            int actual = list[2];

            //Assert
            Assert.AreEqual(expected, actual);
        }
Esempio n. 5
0
        public void RemoveFromList_RemoveWholeList()
        {
            //Arrange
            BriansList <int> list = new BriansList <int>();

            list.Add(1);
            list.Add(2);
            list.Add(3);
            list.Add(4);
            list.Add(5);
            list.Add(6);
            int expected = 0;

            //Act
            for (int i = list.Count - 1; i >= 0; i--)
            {
                list.Remove(list[i]);
            }
            int actual = list.Count;

            //Assert
            Assert.AreEqual(expected, actual);
        }