public void Zip_StringListsWithUnequalCount_ResultingCountEqualsTwiceLowerCount()
        {
            //Arrange
            FakeList <string> firstFakeList = new FakeList <string>()
            {
                "a", "b", "c"
            };
            FakeList <string> secondFakeList = new FakeList <string>()
            {
                "a"
            };
            int firstListCount  = firstFakeList.Count;
            int secondListCount = secondFakeList.Count;
            int shorterListCount;

            //Act
            FakeList <string> zippedList = firstFakeList.Zip(secondFakeList);

            if (firstListCount < secondListCount)
            {
                shorterListCount = firstListCount;
            }
            else
            {
                shorterListCount = secondListCount;
            }
            int expectedZippedListCount = 2 * shorterListCount;

            //Assert
            Assert.AreEqual(expectedZippedListCount, zippedList.Count);
        }
        public void Zip_EqualCountIntegerLists_SecondListFirstIndexBecomesSecondIndexOfZipper()
        {
            //Arrange
            FakeList <int> firstFakeList  = new FakeList <int>(); //{1,2,3};
            FakeList <int> secondFakeList = new FakeList <int>(); //{4,5,6};

            //Act
            firstFakeList.Add(1);
            firstFakeList.Add(2);
            firstFakeList.Add(3);
            secondFakeList.Add(4);
            secondFakeList.Add(5);
            secondFakeList.Add(6);
            FakeList <int> zippedList = firstFakeList.Zip(secondFakeList);

            //Assert
            Assert.AreEqual(secondFakeList[0], zippedList[1]);
        }
        [TestMethod]//To show {1,2,3}.Zip({4,5}) --> {1,4,2,5}
        public void Zip_SecondIntegerListCountLower_FirstListLosesItems()
        {
            //Arrange
            FakeList <int> firstFakeList = new FakeList <int>()
            {
                1, 2, 3
            };
            FakeList <int> secondFakeList = new FakeList <int>()
            {
                4, 5
            };
            int expectedZippedListCount = 4;

            //Act
            FakeList <int> zippedList = firstFakeList.Zip(secondFakeList);

            //Assert
            Assert.AreEqual(expectedZippedListCount, zippedList.Count);
        }
Exemple #4
0
        static void Main(string[] args)
        {
            FakeList <int> testList1 = new FakeList <int>()
            {
                1, 2, 3
            };
            FakeList <int> testList2 = new FakeList <int>()
            {
                4, 5, 6
            };
            FakeList <int> testList3 = new FakeList <int>()
            {
                7, 8
            };
            FakeList <int> testList4 = new FakeList <int>()
            {
                10, 11, 12, 13
            };

            Console.WriteLine(testList1.Zip(testList2, testList3, testList4));
            Console.ReadLine();
        }