コード例 #1
0
        public void Remove_Value_FromFirstIndexFound()
        {
            CustomList <int> list = new CustomList <int>();
            int expected          = 2;
            int value1            = 5;
            int value2            = 2;
            int value3            = 5;
            int value4            = 5;
            int value5            = 5;

            list.Add(value1);
            list.Add(value2);
            list.Add(value3);
            list.Add(value4);
            list.Add(value5);

            list.Remove(5);

            Assert.AreEqual(expected, list[0]);
        }
コード例 #2
0
        public void Remove_Item_From_List_Check_Count()
        {
            //arrange
            CustomList <int> list = new CustomList <int>();
            int expectedCount     = 4;



            //act
            list.Add(10);
            list.Add(20);
            list.Add(30);
            list.Add(40);
            list.Add(50);
            list.Remove(50);
            int actualCount = list.Count;


            //assert
            Assert.AreEqual(expectedCount, actualCount);
        }
コード例 #3
0
        public void ToStringMethod_Add5Ints_Returns1StringWith1345()
        {
            //Arrange
            CustomList <int> list     = new CustomList <int>();
            string           expected = "1345";
            string           actual;

            //Action
            list.Add(1);
            list.Add(2);
            list.Add(3);
            list.Add(4);
            list.Add(5);
            list.Remove(2);

            actual = list.ToString();


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