Ejemplo n.º 1
0
        public void cRemove_CheckArrayCount_EmpytList() // if an object is removed, does count reflect
        {
            //Arrange
            List_Custom <int> testItem = new List_Custom <int>();
            int intToBeEntererd        = 10;
            int expectedValue          = 0;

            //Act
            testItem.Add(intToBeEntererd);
            testItem.Remove(intToBeEntererd);
            //Assert
            Assert.AreEqual(expectedValue, testItem.count);
        }
Ejemplo n.º 2
0
        public void cRemove_RemoveIndexNotEqualToIndex_ValuesAreNotEqual()
        {
            //Arrange
            List_Custom <int> testItem = new List_Custom <int>();
            int expectedResult0        = 10;
            int expectedResult1        = 20;
            int expectedResult2        = 40;
            int expectedResult3        = 60;

            //Act
            testItem.Add(expectedResult0);
            testItem.Add(expectedResult1);
            testItem.Add(expectedResult2);
            testItem.Add(expectedResult3);
            testItem.Remove(expectedResult0);
            //Assert
            Assert.IsFalse(expectedResult0 == testItem[0]);
            // after I remove the index 0, it should not equal whats now at index 0
            // not a very testy test -
        }
Ejemplo n.º 3
0
        public void PlusOp_NewListBehavior_IndexInCorrectPostion()
        {
            //Arrange
            List_Custom <int> list1 = new List_Custom <int>();
            List_Custom <int> list2 = new List_Custom <int>();
            List_Custom <int> list3 = new List_Custom <int>();
            int list1index0         = 10;
            int list1index1         = 20;
            int list2index0         = 15;
            int list2index1         = 25;

            list1.Add(list1index0);
            list1.Add(list1index1);
            list1.Add(list2index0);
            list1.Add(list2index1);
            //Act
            list3 = list1 + list2;
            list3.Remove(list3[1]);
            //Assert
            Assert.AreEqual(3, list3.count);
        }
Ejemplo n.º 4
0
        public void PlusOp_ListBehaveAdd_ReorderOfIndexs()
        {
            //Arrange
            List_Custom <int> list1 = new List_Custom <int>();
            List_Custom <int> list2 = new List_Custom <int>();
            List_Custom <int> list3 = new List_Custom <int>();
            int list1index0         = 10;
            int list1index1         = 20;
            int list2index0         = 15;
            int list2index1         = 25;

            list1.Add(list1index0);
            list1.Add(list1index1);
            list1.Add(list2index0);
            list1.Add(list2index1);
            //Act
            list3 = list1 + list2;
            list3.Remove(list3[1]);
            list3.Add(list1index1);
            //Assert
            Assert.AreEqual(list1index1, list3[3]);
        }
Ejemplo n.º 5
0
        public void PlusOp_NewListBehaveCount_CountRelfectsCorrectly()
        {
            //Arrange
            List_Custom <int> list1 = new List_Custom <int>();
            List_Custom <int> list2 = new List_Custom <int>();
            List_Custom <int> list3 = new List_Custom <int>();
            int list1index0         = 10;
            int list1index1         = 20;
            int list2index0         = 15;
            int list2index1         = 25;

            list1.Add(list1index0);
            list1.Add(list1index1);
            list1.Add(list2index0);
            list1.Add(list2index1);
            //Act
            list3 = list1 + list2;
            list3.Remove(list3[1]);
            list3.Add(list1index1);
            //Assert
            Assert.AreEqual(4, list3.count);
        }
Ejemplo n.º 6
0
        public void cRemove_RemoveMultiStrings_OnlyOneStringRemoved()
        {
            //Arrange
            List_Custom <string> testItem = new List_Custom <string>();
            string expectedResult0        = "I";
            string expectedResult1        = "love";
            string expectedResult2        = "am";
            string expectedResult3        = "love";
            string expectedResult4        = "indifferent";

            //Act
            testItem.Add(expectedResult0);
            testItem.Add(expectedResult1);
            testItem.Add(expectedResult2);
            testItem.Add(expectedResult3);
            testItem.Add(expectedResult4);
            testItem.Remove("love");
            //Assert
            Assert.AreEqual(4, testItem.count);
            // function needs to loop through entire legth of array
            // and remove all instances of the parameter passed
        }
Ejemplo n.º 7
0
        public void cRemove_RemoveInstanceOfString_RemovedInstanceArrayShifted()
        {
            //Arrange
            List_Custom <string> testItem = new List_Custom <string>();
            string ToBeEntered0           = "I";
            string ToBeEntered1           = "love";
            string ToBeEntered2           = "am";
            string ToBeEntered3           = "love";
            string ToBeEntered4           = "indifferent";
            string expectedString         = "love";

            //Act
            testItem.Add(ToBeEntered0);
            testItem.Add(ToBeEntered1);
            testItem.Add(ToBeEntered2);
            testItem.Add(ToBeEntered3);
            testItem.Add(ToBeEntered4);
            testItem.Remove("love");
            //Assert
            Assert.AreEqual(expectedString, testItem[2]);
            // after removing one instance of string, did all the other strings shift?
            // is there still other strings like the one i just removed?
        }