Ejemplo n.º 1
0
        public void Remove_RemoveIntAtIndex2_ValueNoLongerInList()
        {
            //arrange
            ScratchList <int> testList = new ScratchList <int>();
            bool actual;
            bool expected = false;

            testList.Add(2);
            testList.Add(33);
            testList.Add(7);
            testList.Add(12);

            //act
            testList.Remove(testList[2]);
            if (testList[0] == 7 || testList[1] == 7 || testList[2] == 7)
            {
                actual = true;
            }
            else
            {
                actual = false;
            }

            //assert
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 2
0
        public void Remove_Remove1of3ints_countis2()
        {
            //arrange
            ScratchList <int> testList = new ScratchList <int>();
            int actual;
            int expected = 2;

            testList.Add(2);
            testList.Add(33);
            testList.Add(7);

            //act
            testList.Remove(33);
            actual = testList.Count;

            //assert
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 3
0
        public void Remove_RemoveIntAtIndex2_IntAtIndex3IsNowAtIndex2()
        {
            //arrange
            ScratchList <int> testList = new ScratchList <int>();
            int actual;
            int expected = 12;

            testList.Add(2);
            testList.Add(33);
            testList.Add(7);
            testList.Add(12);

            //act
            testList.Remove(testList[2]);
            actual = testList[2];

            //assert
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 4
0
        public void Remove_Remove4thof5Ints_Index4ValueNowAtIndex3()
        {
            //arrange
            ScratchList <int> testList = new ScratchList <int>();
            int actual;
            int expected = 3;

            testList.Add(2);
            testList.Add(33);
            testList.Add(7);
            testList.Add(12);
            testList.Add(3);

            //act
            testList.Remove(12);
            actual = testList[3];

            //assert
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 5
0
        public void Remove_UserInputNotInList_ListRemainsUnchanged()
        {
            //arrange
            ScratchList <int> testList = new ScratchList <int>();
            int actual;
            int expected = 6;

            testList.Add(2);
            testList.Add(33);
            testList.Add(7);
            testList.Add(12);
            testList.Add(7);
            testList.Add(3);

            //act
            testList.Remove(5);
            actual = testList.Count;

            //assert
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 6
0
        public void Remove_RemoveRepeatedValue_OnlyEarliestIncidentOfThatValueIsRemoved()
        {
            //arrange
            ScratchList <int> testList = new ScratchList <int>();
            int actual;
            int expected = 7;

            testList.Add(2);
            testList.Add(33);
            testList.Add(7);
            testList.Add(12);
            testList.Add(7);
            testList.Add(3);

            //act
            testList.Remove(7);
            actual = testList[3];

            //assert
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 7
0
        public void Remove_RemoveRepeatedValue_CountDecreaseBy1()
        {
            //arrange
            ScratchList <int> testList = new ScratchList <int>();
            int actual;
            int expected = 5;

            testList.Add(2);
            testList.Add(33);
            testList.Add(7);
            testList.Add(12);
            testList.Add(7);
            testList.Add(3);

            //act
            testList.Remove(7);
            actual = testList.Count;

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