예제 #1
0
        public void RemoveFourElements_Remove_IndexZeroToThree()
        {
            MadeUpList <int> myList = new MadeUpList <int>();

            int[] MadeUpList     = new[] { 16, 15, 14, 13, 12, 11, 10 };
            int   expectedValue1 = 16;
            int   expectedValue2 = 15;
            int   expectedValue3 = 14;
            int   expectedValue4 = 13;
            int   actualValue1;
            int   actualValue2;
            int   actualValue3;
            int   actualValue4;

            myList.Remove(expectedValue1);
            myList.Remove(expectedValue2);
            myList.Remove(expectedValue3);
            myList.Remove(expectedValue4);
            actualValue1 = MadeUpList[0];
            actualValue2 = MadeUpList[1];
            actualValue3 = MadeUpList[2];
            actualValue4 = MadeUpList[3];

            Assert.AreEqual(expectedValue1, actualValue1);
            Assert.AreEqual(expectedValue2, actualValue2);
            Assert.AreEqual(expectedValue3, actualValue3);
            Assert.AreEqual(expectedValue4, actualValue4);
        }
예제 #2
0
        public void ZipStringLists_Zip_ArraysAreZipped()
        {
            MadeUpList <string> list1 = new MadeUpList <string>();
            MadeUpList <string> list2 = new MadeUpList <string>();

            list1.Add("1");
            list1.Add("2");
            list1.Add("3");
            list1.Add("4");
            list2.Add("5");
            list2.Add("6");
            list2.Add("7");
            list2.Add("8");

            MadeUpList <string> list3 = list1.Zip(list2);

            Assert.AreEqual(list3[0], "1");
            Assert.AreEqual(list3[1], "5");
            Assert.AreEqual(list3[2], "2");
            Assert.AreEqual(list3[3], "6");
            Assert.AreEqual(list3[4], "3");
            Assert.AreEqual(list3[5], "7");
            Assert.AreEqual(list3[6], "4");
            Assert.AreEqual(list3[7], "8");
        }
예제 #3
0
        public void IndexesShouldHaveValue_GetEnumerator_Value()
        {
            MadeUpList <int> myList = new MadeUpList <int>();

            int[] madeUpList = new int[5] {
                1, 2, 3, 4, 5
            };
        }
예제 #4
0
        public void RemoveTenElements_Remove_IndexZeroToNine()
        {
            MadeUpList <int> myList = new MadeUpList <int>();

            int[] MadeUpList      = new[] { 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3 };
            int   expectedValue1  = 16;
            int   expectedValue2  = 15;
            int   expectedValue3  = 14;
            int   expectedValue4  = 13;
            int   expectedValue5  = 12;
            int   expectedValue6  = 11;
            int   expectedValue7  = 10;
            int   expectedValue8  = 9;
            int   expectedValue9  = 8;
            int   expectedValue10 = 7;
            int   actualValue1;
            int   actualValue2;
            int   actualValue3;
            int   actualValue4;
            int   actualValue5;
            int   actualValue6;
            int   actualValue7;
            int   actualValue8;
            int   actualValue9;
            int   actualValue10;

            myList.Remove(expectedValue1);
            myList.Remove(expectedValue2);
            myList.Remove(expectedValue3);
            myList.Remove(expectedValue4);
            myList.Remove(expectedValue5);
            myList.Remove(expectedValue6);
            myList.Remove(expectedValue7);
            myList.Remove(expectedValue8);
            myList.Remove(expectedValue9);
            myList.Remove(expectedValue10);
            actualValue1  = MadeUpList[0];
            actualValue2  = MadeUpList[1];
            actualValue3  = MadeUpList[2];
            actualValue4  = MadeUpList[3];
            actualValue5  = MadeUpList[4];
            actualValue6  = MadeUpList[5];
            actualValue7  = MadeUpList[6];
            actualValue8  = MadeUpList[7];
            actualValue9  = MadeUpList[8];
            actualValue10 = MadeUpList[9];

            Assert.AreEqual(expectedValue1, actualValue1);
            Assert.AreEqual(expectedValue2, actualValue2);
            Assert.AreEqual(expectedValue3, actualValue3);
            Assert.AreEqual(expectedValue4, actualValue4);
            Assert.AreEqual(expectedValue5, actualValue5);
            Assert.AreEqual(expectedValue6, actualValue6);
            Assert.AreEqual(expectedValue7, actualValue7);
            Assert.AreEqual(expectedValue8, actualValue8);
            Assert.AreEqual(expectedValue9, actualValue9);
            Assert.AreEqual(expectedValue10, actualValue10);
        }
예제 #5
0
        public void AddNewInstance_OperatorOverLoad_AddNewIntInstance()
        {
            MadeUpList <int> aList = new MadeUpList <int>();

            int[] list1         = new[] { 1, 2 };
            int[] list2         = new[] { 3, 4 };
            int   expectedValue = (list1[0] + list1[1]) + (list2[0] + list2[1]);
            int   actualValue;

            actualValue = expectedValue;

            Assert.AreEqual(expectedValue, actualValue);
        }
예제 #6
0
        public void AddOneElement_AddIndex_IndexZero()
        {
            MadeUpList <int> myList = new MadeUpList <int>();

            int[] MadeUpList    = new[] { 16 };
            int   expectedValue = 16;
            int   actualValue;

            myList.Add(expectedValue);
            actualValue = MadeUpList[0];

            Assert.AreEqual(expectedValue, actualValue);
        }
예제 #7
0
        public void RemoveOneElement_RemoveCount_IndexZero()
        {
            MadeUpList <int> myList = new MadeUpList <int>();

            int[] MadeUpList    = new int[] { 16, 15 };
            int   expectedValue = 16;
            int   actualValue;

            myList.Remove(expectedValue);
            actualValue = MadeUpList[0];

            Assert.AreEqual(expectedValue, actualValue);
        }
예제 #8
0
        public void CountIndex_Count_Length()
        {
            MadeUpList <int> myList = new MadeUpList <int>();
            int expected            = 4;

            myList.Add(4);
            myList.Add(5);
            myList.Add(6);
            myList.Add(7);

            int actual = myList.ArrayCount;

            Assert.AreEqual(expected, actual);
        }
예제 #9
0
        public void SubtractInstance_OverLoadOperator_OneInstance()
        {
            MadeUpList <int> aList = new MadeUpList <int>();

            int[] list1    = new[] { 1, 2 };
            int[] list2    = new[] { 3, 4 };
            int   testList = (list1[0] + list1[1]) + (list2[0] + list2[1]);
            int   expected = (list1[0] + list1[1]);
            int   actual;

            actual = testList - (list2[0] + list2[1]);

            Assert.AreEqual(expected, actual);
        }
예제 #10
0
        public void MyOverrideToString_ToString_CheckReturn()
        {
            MadeUpList<int> myList = new MadeUpList<int>();
            int[] stringList = new int[] {1 };
            string expectedValue = "1" ;


           

            string actualValue = stringList[0].ToString();

            Assert.AreEqual(expectedValue, actualValue);


        }
예제 #11
0
        public void BoolTest_Zip_ZipsBooleans()
        {
            MadeUpList <bool> list1 = new MadeUpList <bool>();
            MadeUpList <bool> list2 = new MadeUpList <bool>();

            list1.Add(true);
            list1.Add(false);
            list2.Add(true);
            list2.Add(false);

            MadeUpList <bool> list3 = list1.Zip(list2);

            Assert.AreEqual(list3[0], true);
            Assert.AreEqual(list3[1], true);
            Assert.AreEqual(list3[2], false);
            Assert.AreEqual(list3[3], false);
        }
예제 #12
0
        public void AddNewInstance_OverLoadPlus_TwoInstances()
        {
            MadeUpList <string> myList = new MadeUpList <string>();

            string[] newList   = new[] { "bob", "dole" };
            string   expected1 = "bob" + "brian";
            string   expected2 = "dole" + "mono";
            string   actual1;
            string   actual2;

            string[] anotherList = new[] { "brian", "mono" };
            actual1 = newList[0] + anotherList[0];
            actual2 = newList[1] + anotherList[1];

            Assert.AreEqual(expected1, actual1);
            Assert.AreEqual(expected2, actual2);
        }
예제 #13
0
        public void CheckIndexer_MyIndexer_CheckValues()
        {
            MadeUpList <int> myMadeUpList = new MadeUpList <int>();

            int[] myList = new[] { 12, 13, 14, 15, 16, 17, 18 };
            myList[2] = 15;
            myList[3] = 16;
            int expectedValue1 = 15;
            int expectedValue2 = 16;
            int actualValue1;
            int actualValue2;

            actualValue1 = myList[2];
            actualValue2 = myList[3];

            Assert.AreEqual(expectedValue1, actualValue1);
            Assert.AreEqual(expectedValue2, actualValue2);
        }
예제 #14
0
        public void AddTwoElements_AddIndex_IndexZeroToOne()
        {
            MadeUpList <int> myList = new MadeUpList <int>();

            int[] MadeUpList     = new[] { 16, 15 };
            int   expectedValue1 = 16;
            int   expectedValue2 = 15;
            int   actualValue1;
            int   actualValue2;

            myList.Add(expectedValue1);
            myList.Add(expectedValue2);
            actualValue1 = MadeUpList[0];
            actualValue2 = MadeUpList[1];

            Assert.AreEqual(expectedValue1, actualValue1);
            Assert.AreEqual(expectedValue2, actualValue2);
        }
예제 #15
0
        public void RemoveTwoElements_RemoveCount_IndexZeroToOne()
        {
            MadeUpList <int> myList = new MadeUpList <int>();

            int[] MadeUpList     = new[] { 16, 15, 14, 13 };
            int   expectedValue1 = 16;
            int   expectedValue2 = 15;
            int   actualValue1;
            int   actualValue2;

            myList.Remove(expectedValue1);
            myList.Remove(expectedValue2);
            actualValue1 = MadeUpList[0];
            actualValue2 = MadeUpList[1];

            Assert.AreEqual(expectedValue1, actualValue1);
            Assert.AreEqual(expectedValue2, actualValue2);
        }
예제 #16
0
        public void ZipIntLists_Zip_ArraysZipped()
        {
            MadeUpList <int> list1 = new MadeUpList <int>();
            MadeUpList <int> list2 = new MadeUpList <int>();

            list1.Add(1);
            list1.Add(3);
            list1.Add(5);
            list2.Add(2);
            list2.Add(4);
            list2.Add(6);

            MadeUpList <int> list3 = list1.Zip(list2);

            Assert.AreEqual(list3[0], 1);
            Assert.AreEqual(list3[1], 2);
            Assert.AreEqual(list3[2], 3);
            Assert.AreEqual(list3[3], 4);
            Assert.AreEqual(list3[4], 5);
            Assert.AreEqual(list3[5], 6);
        }
예제 #17
0
        public void MyOverrrideToString_ToString_MultipleInts()
        {
            MadeUpList<int> stringTest = new MadeUpList<int>();
            int[] stringList = new[] { 17, 18, 19, 20};
            string expectedValue1 = "17";
            string expectedValue2 = "18";
            string expectedValue3 = "19";
            string expectedValue4 = "20";
            string actualValue1;
            string actualValue2;
            string actualValue3;
            string actualValue4;



            actualValue1 = stringList[0].ToString();
            actualValue2 = stringList[1].ToString();
            actualValue3 = stringList[2].ToString();
            actualValue4 = stringList[3].ToString();
            Assert.AreEqual(expectedValue1, actualValue1);
            Assert.AreEqual(expectedValue2, actualValue2);
            Assert.AreEqual(expectedValue3, actualValue3);
            Assert.AreEqual(expectedValue4, actualValue4);
        }
예제 #18
0
        public void AddTwelveElements_AddIndex_IndexZeroToEleven()
        {
            MadeUpList <int> myList = new MadeUpList <int>();

            int[] MadeUpList      = new[] { 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5 };
            int   expectedValue1  = 16;
            int   expectedValue2  = 15;
            int   expectedValue3  = 14;
            int   expectedValue4  = 13;
            int   expectedValue5  = 12;
            int   expectedValue6  = 11;
            int   expectedValue7  = 10;
            int   expectedValue8  = 9;
            int   expectedValue9  = 8;
            int   expectedValue10 = 7;
            int   expectedValue11 = 6;
            int   expectedValue12 = 5;
            int   actualValue1;
            int   actualValue2;
            int   actualValue3;
            int   actualValue4;
            int   actualValue5;
            int   actualValue6;
            int   actualValue7;
            int   actualValue8;
            int   actualValue9;
            int   actualValue10;
            int   actualValue11;
            int   actualValue12;

            myList.Add(expectedValue1);
            myList.Add(expectedValue2);
            myList.Add(expectedValue3);
            myList.Add(expectedValue4);
            myList.Add(expectedValue5);
            myList.Add(expectedValue6);
            myList.Add(expectedValue7);
            myList.Add(expectedValue8);
            myList.Add(expectedValue9);
            myList.Add(expectedValue10);
            myList.Add(expectedValue11);
            myList.Add(expectedValue12);
            actualValue1  = MadeUpList[0];
            actualValue2  = MadeUpList[1];
            actualValue3  = MadeUpList[2];
            actualValue4  = MadeUpList[3];
            actualValue5  = MadeUpList[4];
            actualValue6  = MadeUpList[5];
            actualValue7  = MadeUpList[6];
            actualValue8  = MadeUpList[7];
            actualValue9  = MadeUpList[8];
            actualValue10 = MadeUpList[9];
            actualValue11 = MadeUpList[10];
            actualValue12 = MadeUpList[11];

            Assert.AreEqual(expectedValue1, actualValue1);
            Assert.AreEqual(expectedValue2, actualValue2);
            Assert.AreEqual(expectedValue3, actualValue3);
            Assert.AreEqual(expectedValue4, actualValue4);
            Assert.AreEqual(expectedValue5, actualValue5);
            Assert.AreEqual(expectedValue6, actualValue6);
            Assert.AreEqual(expectedValue7, actualValue7);
            Assert.AreEqual(expectedValue8, actualValue8);
            Assert.AreEqual(expectedValue9, actualValue9);
            Assert.AreEqual(expectedValue10, actualValue10);
            Assert.AreEqual(expectedValue11, actualValue11);
            Assert.AreEqual(expectedValue12, actualValue12);
        }
예제 #19
0
        public void RemoveTwelveElements_Remove_IndexZeroToEleven()
        {
            MadeUpList <int> myList = new MadeUpList <int>();

            int[] MadeUpList      = new[] { 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
            int   expectedValue1  = 12;
            int   expectedValue2  = 11;
            int   expectedValue3  = 10;
            int   expectedValue4  = 9;
            int   expectedValue5  = 8;
            int   expectedValue6  = 7;
            int   expectedValue7  = 6;
            int   expectedValue8  = 5;
            int   expectedValue9  = 4;
            int   expectedValue10 = 3;
            int   expectedValue11 = 2;
            int   expectedValue12 = 1;
            int   actualValue1;
            int   actualValue2;
            int   actualValue3;
            int   actualValue4;
            int   actualValue5;
            int   actualValue6;
            int   actualValue7;
            int   actualValue8;
            int   actualValue9;
            int   actualValue10;
            int   actualValue11;
            int   actualValue12;

            myList.Remove(expectedValue1);
            myList.Remove(expectedValue2);
            myList.Remove(expectedValue3);
            myList.Remove(expectedValue4);
            myList.Remove(expectedValue5);
            myList.Remove(expectedValue6);
            myList.Remove(expectedValue7);
            myList.Remove(expectedValue8);
            myList.Remove(expectedValue9);
            myList.Remove(expectedValue10);
            myList.Remove(expectedValue11);
            myList.Remove(expectedValue12);
            actualValue1  = MadeUpList[0];
            actualValue2  = MadeUpList[1];
            actualValue3  = MadeUpList[2];
            actualValue4  = MadeUpList[3];
            actualValue5  = MadeUpList[4];
            actualValue6  = MadeUpList[5];
            actualValue7  = MadeUpList[6];
            actualValue8  = MadeUpList[7];
            actualValue9  = MadeUpList[8];
            actualValue10 = MadeUpList[9];
            actualValue11 = MadeUpList[10];
            actualValue12 = MadeUpList[11];

            Assert.AreEqual(expectedValue1, actualValue1);
            Assert.AreEqual(expectedValue2, actualValue2);
            Assert.AreEqual(expectedValue3, actualValue3);
            Assert.AreEqual(expectedValue4, actualValue4);
            Assert.AreEqual(expectedValue5, actualValue5);
            Assert.AreEqual(expectedValue6, actualValue6);
            Assert.AreEqual(expectedValue7, actualValue7);
            Assert.AreEqual(expectedValue8, actualValue8);
            Assert.AreEqual(expectedValue9, actualValue9);
            Assert.AreEqual(expectedValue10, actualValue10);
            Assert.AreEqual(expectedValue11, actualValue11);
            Assert.AreEqual(expectedValue12, actualValue12);
        }