示例#1
0
        public void If_Both_Lists_Are_Empty_Test()
        {
            //arrange
            DataStructures.LinkedLists listOne = new LinkedLists();
            DataStructures.LinkedLists listTwo = new LinkedLists();
            string expected = "NULL";

            //act
            DataStructures.LinkedLists actualList = LLchallenges.mergeLists(listTwo, listOne);
            string actual = actualList.ToString();

            //Assert
            Assert.Equal(expected, actual);
        }
示例#2
0
        public void If_First_List_Is_Empty_Test()
        {
            //arrange
            DataStructures.LinkedLists listOne = new LinkedLists();
            listOne.Insert(15);
            listOne.Insert(10);
            listOne.Insert(5);
            DataStructures.LinkedLists listTwo = new LinkedLists();
            string expected = "{5} => {10} => {15} => NULL";

            //act
            DataStructures.LinkedLists actualList = LLchallenges.mergeLists(listTwo, listOne);
            string actual = actualList.ToString();

            //Assert
            Assert.Equal(expected, actual);
        }
示例#3
0
        public void Can_Merge_Lists_Of_Different_Lengths_Shorter_First_Test()
        {
            //arrange
            DataStructures.LinkedLists listOne = new LinkedLists();
            listOne.Insert(15);
            listOne.Insert(10);
            listOne.Insert(5);
            DataStructures.LinkedLists listTwo = new LinkedLists();
            listTwo.Insert(12);
            listTwo.Insert(6);
            string expected = "{6} => {5} => {12} => {10} => {15} => NULL";

            //act
            DataStructures.LinkedLists actualList = LLchallenges.mergeLists(listTwo, listOne);
            string actual = actualList.ToString();

            //Assert
            Assert.Equal(expected, actual);
        }
示例#4
0
        public void Can_Merge_Test()
        {
            //arrange
            DataStructures.LinkedLists listOne = new LinkedLists();
            listOne.Insert(15);
            listOne.Insert(10);
            listOne.Insert(5);
            DataStructures.LinkedLists listTwo = new LinkedLists();
            listTwo.Insert(18);
            listTwo.Insert(12);
            listTwo.Insert(6);
            string expected = "{5} => {6} => {10} => {12} => {15} => {18} => NULL";

            //act
            DataStructures.LinkedLists actualList = LLchallenges.mergeLists(listOne, listTwo);
            string actual = actualList.ToString();

            //Assert
            Assert.Equal(expected, actual);
        }