예제 #1
0
        public void AddAtIndex_AddStringAtIndexThreeToListOfStrings_VerifyResultingListUsingToString()
        {
            //Arrange
            CustomList <string> list  = new CustomList <string>();
            string firstString        = "One";
            string secondString       = "Two";
            string thirdString        = "Three";
            string fourthString       = "Four";
            string fifthString        = "Five";
            string sixthString        = "Six";
            string stringToBeInserted = "Three-and-a-Half";
            string expected           = "OneTwoThreeThree-and-a-HalfFourFiveSix";

            //Act
            list.Add(firstString);
            list.Add(secondString);
            list.Add(thirdString);
            list.Add(fourthString);
            list.Add(fifthString);
            list.Add(sixthString);
            list.AddAtIndex(stringToBeInserted, 3);
            //Assert
            Assert.AreEqual(expected, list.ToString());
        }
예제 #2
0
        public void AddAtIndex_AddStringAtIndexThreeToListOfStrings_CountHasIncreasedByOne()
        {
            //Arrange
            CustomList <string> list  = new CustomList <string>();
            string firstString        = "One";
            string secondString       = "Two";
            string thirdString        = "Three";
            string fourthString       = "Four";
            string fifthString        = "Five";
            string sixthString        = "Six";
            string stringToBeInserted = "Three-and-a-Half";
            int    expected           = 7;

            //Act
            list.Add(firstString);
            list.Add(secondString);
            list.Add(thirdString);
            list.Add(fourthString);
            list.Add(fifthString);
            list.Add(sixthString);
            list.AddAtIndex(stringToBeInserted, 3);
            //Assert
            Assert.AreEqual(expected, list.Count);
        }