Пример #1
0
        public void AddFourElements_AddIndex_IndexZeroToThree()
        {
            MadeUpList <int> myList = new MadeUpList <int>();

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

            myList.Add(expectedValue1);
            myList.Add(expectedValue2);
            myList.Add(expectedValue3);
            myList.Add(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 AddTenElements_AddIndex_IndexZeroToNine()
        {
            MadeUpList <int> myList = new MadeUpList <int>();

            int[] MadeUpList      = new[] { 16, 15, 14, 13, 12, 11, 10, 9, 8, 7 };
            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.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);
            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);
        }
Пример #4
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);
        }
Пример #5
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);
        }
Пример #6
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);
        }
Пример #7
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);
        }
Пример #8
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);
        }