예제 #1
0
        public void MinuOp_RemovingEntireListContents_RemnantsHaveIndex()
        {
            //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 list1index2         = 25;
            int list1index3         = 30;
            int list1index4         = 35;
            int list1index5         = 35;
            int list2index0         = 15;
            int list2index1         = 25;
            int list2index2         = 10;
            int list2index3         = 30;
            int list2index4         = 35;

            list1.Add(list1index0);
            list1.Add(list1index1);
            list1.Add(list1index2);
            list2.Add(list2index0);
            list2.Add(list2index1);
            list2.Add(list2index2);
            list1.Add(list1index3);
            list1.Add(list1index4);
            list2.Add(list2index3);
            list2.Add(list2index4);
            list2.Add(list1index5);
            //Act
            list3 = list1 - list2;
            //Assert
            Assert.AreEqual(list1index1, list3[0]);
        }
예제 #2
0
        public void ResizeHelper_QuadSizeofOrignial_intsAdded() // array of size 8 should double to 16
        {
            //Arrange
            List_Custom <int> myList = new List_Custom <int>();
            int expectedIndex0       = 10;
            int expectedIndex1       = 5;
            int expectedIndex2       = 3;
            int expectedIndex3       = 2;
            int expectedIndex4       = 7;
            int expectedIndex5       = 8;
            int expectedIndex6       = 9;
            int expectedIndex7       = 10;
            int expectedIndex8       = 11;

            //Act
            myList.Add(expectedIndex0);
            myList.Add(expectedIndex1);
            myList.Add(expectedIndex2);
            myList.Add(expectedIndex3);
            myList.Add(expectedIndex4);
            myList.Add(expectedIndex5);
            myList.Add(expectedIndex6);
            myList.Add(expectedIndex7);
            myList.Add(expectedIndex8);

            //Assert
            Assert.AreEqual(expectedIndex7, myList[7]);
        }
예제 #3
0
        public void PlusOp_ConcatTwoLists_ValueAtIndex3()
        {
            //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 list1index2         = 40;
            int list1index3         = 60;
            int list2index0         = 15;
            int list2index1         = 25;
            int list2index2         = 35;
            int list2index3         = 45;

            list1.Add(list1index0);
            list1.Add(list1index1);
            list1.Add(list1index2);
            list1.Add(list1index3);
            list1.Add(list2index0);
            list1.Add(list2index1);
            list1.Add(list2index2);
            list1.Add(list2index3);
            //Act
            list3 = list1 + list2;
            //Assert
            Assert.AreEqual(list1index3, list3[3]);
        }
예제 #4
0
        public void Placement_intAdded() // upon adding an ojb - correct place?
        {
            //Arrange
            List_Custom <int> myList = new List_Custom <int>();
            int expectedResult       = 10;
            int expectedResult2      = 5;

            //Act
            myList.Add(expectedResult);
            myList.Add(expectedResult2);

            //Assert
            Assert.AreEqual(expectedResult, myList[0]);
        }
예제 #5
0
        public void PlacementIndex_intAdd() // upon adding a second object - correct placement ??
        {
            //Arrange
            List_Custom <int> myList = new List_Custom <int>();
            int expectedResult       = 10;
            int expectedResult2      = 5;

            //Act
            myList.Add(expectedResult);
            myList.Add(expectedResult2);

            //Assert
            Assert.AreEqual(expectedResult2, myList[1]);
        }
예제 #6
0
        public void PlacementIndex_thirdPlace_intAdded() // upon adding a third object - correct placement ??
        {
            //Arrange
            List_Custom <int> myList = new List_Custom <int>();
            int expectedResult       = 10;
            int expectedResult2      = 5;
            int expectedResult3      = 3;

            //Act
            myList.Add(expectedResult);
            myList.Add(expectedResult2);
            myList.Add(expectedResult3);

            //Assert
            Assert.AreEqual(expectedResult3, myList[2]);
        }
예제 #7
0
        public void cAdd_Strings_CorrectIndex()
        {
            //Arrange
            List_Custom <string> myList = new List_Custom <string>();
            string expectedResult       = "Testing";
            string expectedResult1      = "string";
            string expectedResult2      = "input";
            string expectedResult3      = ".";

            //Act
            myList.Add(expectedResult);
            myList.Add(expectedResult1);
            myList.Add(expectedResult2);
            myList.Add(expectedResult3);

            //Assert
            Assert.AreEqual(expectedResult3, myList[3]);
        }
예제 #8
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 -
        }
예제 #9
0
        public void PlusOp_ConcatTwoLists_()
        {
            //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);
            list2.Add(list2index0);
            list2.Add(list2index1);
            //Act
            list3 = list1 + list2;
            //Assert
            Assert.AreEqual(list1index1, list3[1]);
        }
예제 #10
0
        public void PlusOp_CountOfNewList_CountReflectsAddedValues()
        {
            //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;
            //Assert
            Assert.AreEqual(4, list3.count);
        }
예제 #11
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);
        }
예제 #12
0
        public void AddMethod_intAdded() // cAdd method adds to list?
        {
            //Arrange
            List_Custom <int> myList = new List_Custom <int>();
            int expectedResult       = 10;

            //Act
            myList.Add(expectedResult);

            //Assert
            Assert.AreEqual(expectedResult, myList[0]);
        }
예제 #13
0
        public void Add_DataTypeString_DataTypeAdded()
        {
            //Arrange
            List_Custom <string> myList = new List_Custom <string>();
            string expectedResult       = "Testing";

            //Act
            myList.Add(expectedResult);

            //Assert
            Assert.AreEqual(expectedResult, myList[0]);
        }
예제 #14
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);
        }
예제 #15
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
        }
예제 #16
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]);
        }
예제 #17
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);
        }
예제 #18
0
        public void OverR2String_Int2String_StringValue()
        {
            //Arrange
            List_Custom <int> myList = new List_Custom <int>();
            int    IntAt0            = 2;
            int    IntAt1            = 4;
            int    IntAt2            = 6;
            int    IntAt3            = 8;
            string StringedList      = " 2, 4, 6, 8, ";

            //Act
            myList.Add(IntAt0);
            myList.Add(IntAt1);
            myList.Add(IntAt2);
            myList.Add(IntAt3);
            string outcome = myList.ToString();

            //Assert
            Assert.AreEqual(outcome, StringedList);
            //Test compares if to string method stringifies intigers
            //by comparing the method results with a hardcoded version
        }
예제 #19
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?
        }
예제 #20
0
        public void Iteration_AddingByForeach_IndexMatch()
        {
            List_Custom <int> list1 = new List_Custom <int>()
            {
                2, 4, 6, 8, 10
            };
            List_Custom <int> list2 = new List_Custom <int>();

            foreach (int p in list1)
            {
                list2.Add(p);
            }
            Assert.AreEqual(list2[3], list1[3]);
        }
예제 #21
0
        public void MinuOp_RemovingValuesFromList_NewListIndexMatch()
        {
            //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 list1index2         = 25;
            int list2index0         = 15;
            int list2index1         = 25;
            int list2index2         = 10;

            list1.Add(list1index0);
            list1.Add(list1index1);
            list1.Add(list1index2);
            list2.Add(list2index0);
            list2.Add(list2index1);
            list2.Add(list2index2);
            //Act
            list3 = list1 - list2;
            //Assert
            Assert.AreEqual(list1index1, list3[0]);
        }
예제 #22
0
        public void Iteration_CloneContent_UnevenListValues()
        {
            List_Custom <int> list1 = new List_Custom <int>()
            {
                2, 4, 6, 8, 10
            };
            List_Custom <int> list2 = new List_Custom <int>()
            {
                1, 1
            };

            foreach (int p in list1)
            {
                list2.Add(p);
            }
            Assert.AreEqual(list2[3], list1[1]);
        }
예제 #23
0
        public void ResizeHelper_doubleSize_intsAdded() // should double the size of the array
        {
            //Arrange
            List_Custom <int> myList = new List_Custom <int>();
            int expectedIndex0       = 10;
            int expectedIndex1       = 5;
            int expectedIndex2       = 3;
            int expectedIndex3       = 2;
            int expectedIndex4       = 7;
            int expectedIndex5       = 8;
            int expectedIndex6       = 9;

            //Act
            myList.Add(expectedIndex0);
            myList.Add(expectedIndex1);
            myList.Add(expectedIndex2);
            myList.Add(expectedIndex3);
            myList.Add(expectedIndex4);
            myList.Add(expectedIndex5);
            myList.Add(expectedIndex6);

            //Assert
            Assert.AreEqual(expectedIndex5, myList[5]);
        }
예제 #24
0
        public void PlacementSpecific_intAdded() // with multi objects in list - correct placement of index 2 ??
        {
            //Arrange
            List_Custom <int> myList = new List_Custom <int>();
            int expectedIndex0       = 10;
            int expectedIndex1       = 5;
            int expectedIndex2       = 3;
            int expectedIndex3       = 2;
            int expectedIndex4       = 7;
            int expectedIndex5       = 8;

            //Act
            myList.Add(expectedIndex0);
            myList.Add(expectedIndex1);
            myList.Add(expectedIndex2);
            myList.Add(expectedIndex3);
            myList.Add(expectedIndex4);
            myList.Add(expectedIndex5);

            //Assert
            Assert.AreEqual(expectedIndex3, myList[3]);
        }
예제 #25
0
        public void ResizeHelper_OrginalPOW3_intsAdded() // array of size 4 should now become 64
        {
            //Arrange
            List_Custom <int> myList = new List_Custom <int>();
            int expectedIndex0       = 10;
            int expectedIndex1       = 5;
            int expectedIndex2       = 3;
            int expectedIndex3       = 2;
            int expectedIndex4       = 7;
            int expectedIndex5       = 8;
            int expectedIndex6       = 9;
            int expectedIndex7       = 10;
            int expectedIndex8       = 11;
            int expectedIndex9       = 12;
            int expectedIndex10      = 13;
            int expectedIndex11      = 14;
            int expectedIndex12      = 15;
            int expectedIndex13      = 16;

            //Act
            myList.Add(expectedIndex0);
            myList.Add(expectedIndex1);
            myList.Add(expectedIndex2);
            myList.Add(expectedIndex3);
            myList.Add(expectedIndex4);
            myList.Add(expectedIndex5);
            myList.Add(expectedIndex6);
            myList.Add(expectedIndex7);
            myList.Add(expectedIndex8);
            myList.Add(expectedIndex9);
            myList.Add(expectedIndex10);
            myList.Add(expectedIndex11);
            myList.Add(expectedIndex12);
            myList.Add(expectedIndex13);

            //Assert
            Assert.AreEqual(expectedIndex13, myList[13]);
        }