public void Remove_Item_Method_Removes_Only_First_Instance()
        {
            //Arrange
            CustomList <int> collectionOfNumbers = new CustomList <int>();

            collectionOfNumbers.Add(1);
            collectionOfNumbers.Add(5);
            collectionOfNumbers.Add(3);
            collectionOfNumbers.Add(5);
            collectionOfNumbers.Remove(5);

            //Before remove [1,5,3,5]
            //After remove [1,3,0,5]

            string expected = "[ 1, 3 ]";
            string actual;

            //Act
            collectionOfNumbers.Remove(5);
            actual = collectionOfNumbers.ToString();

            //Assert
            Assert.AreEqual(expected, actual);
        }
Exemple #2
0
        public void Add_ItemsCount_ByThree()
        {
            //Arange

            CustomList <int> collectionOfNumbers = new CustomList <int>();

            int numberOne   = 9;
            int numberTwo   = 5;
            int numberThree = 7;
            int expected    = 3;
            int actual;

            //Act

            collectionOfNumbers.Add(numberOne);
            collectionOfNumbers.Add(numberTwo);
            collectionOfNumbers.Add(numberThree);
            actual = collectionOfNumbers.Count;


            //Assert

            Assert.AreEqual(expected, actual);
        }
Exemple #3
0
        public void Test_for_NumberOfCapacityIncresse()
        {
            //Arange
            CustomList <int> customListCapacity = new CustomList <int>();

            int numOne   = 2;
            int numTwo   = 4;
            int numThree = 6;
            int numFour  = 8;
            int numFive  = 10;
            int expected = 8;
            int actual;

            //act
            customListCapacity.Add(numOne);
            customListCapacity.Add(numTwo);
            customListCapacity.Add(numThree);
            customListCapacity.Add(numFour);
            customListCapacity.Add(numFive);
            actual = customListCapacity.Capacity;

            //Assert
            Assert.AreEqual(expected, actual);
        }
Exemple #4
0
        public void Zip_ZipMethodForSorting_DoesZipMethodZip()
        {
            //Arrange
            CustomList <int> shawnList  = new CustomList <int>();
            CustomList <int> shawnList2 = new CustomList <int>();
            string           expected;
            string           actual;

            //Act
            shawnList.Add(5);
            shawnList2.Add(6);
            shawnList.Add(7);
            shawnList2.Add(8);
            shawnList.Add(9);
            shawnList.Add(10);
            shawnList.Add(11);
            CustomList <int> shawnList3 = shawnList + shawnList2;

            expected = "5, 6, 7, 8, 9, 10, 11";
            actual   = shawnList3.ToString();
            //Assert

            Assert.AreEqual(expected, actual);
        }
        public void Subtract_SmiliarLists_RerturnIndexTwo()
        {
            //Arrange
            CustomList <int> customListOne = new CustomList <int>()
            {
                1, 2, 3, 4, 5, 6, 7
            };
            CustomList <int> customListTwo = new CustomList <int>()
            {
                1, 3, 5, 7
            };
            CustomList <int> newCustomList = new CustomList <int>()
            {
            };
            int indexTest        = 2;
            int numberOfinterest = 6;

            //Act
            newCustomList = customListOne - customListTwo;
            int index = newCustomList[indexTest];

            //Assert
            Assert.AreEqual(index, numberOfinterest);
        }
Exemple #6
0
        public void Zip_FirstListLargerThanSecond()
        {
            // arrange
            CustomList <int> oddTestList    = new CustomList <int>();
            CustomList <int> evenTestList   = new CustomList <int>();
            CustomList <int> resultTestList = new CustomList <int>();
            int expected = 8;

            // act
            oddTestList.Add(1);
            oddTestList.Add(3);
            oddTestList.Add(5);
            oddTestList.Add(7);
            oddTestList.Add(9);

            evenTestList.Add(2);
            evenTestList.Add(4);
            evenTestList.Add(6);
            resultTestList = oddTestList.Zip(evenTestList);
            int actual = resultTestList.Count;

            // assert
            Assert.AreEqual(expected, actual);
        }
Exemple #7
0
        public void Plus_Operator_New_List_ToString_Works_With_Strings()
        {
            //Arrange
            CustomList <string> one    = new CustomList <string>();
            CustomList <string> two    = new CustomList <string>();
            CustomList <string> result = new CustomList <string>();

            one.Add("one");
            one.Add("two");
            one.Add("three");
            two.Add("four");
            two.Add("five");
            two.Add("six");

            string expected = "[ one, two, three, four, five, six ]";
            string actual;

            //Act
            result = one + two;
            actual = result.ToString();

            //Assert
            Assert.AreEqual(expected, actual);
        }
Exemple #8
0
        public void Plus_Operator_New_List_ToString_LooksRight()
        {
            //Arrange
            CustomList <int> one    = new CustomList <int>();
            CustomList <int> two    = new CustomList <int>();
            CustomList <int> result = new CustomList <int>();

            one.Add(1);
            one.Add(2);
            one.Add(3);
            two.Add(4);
            two.Add(5);
            two.Add(6);

            string expected = "[ 1, 2, 3, 4, 5, 6 ]";
            string actual;

            //Act
            result = one + two;
            actual = result.ToString();

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