Exemplo n.º 1
0
        public void Knth_For_List_Of_One()
        {
            //Arrange
            DataStructures.LinkedLists testList = new LinkedLists();
            testList.Insert(44);
            int userInput = 0;

            //act
            int actual = testList.KnthFromEnd(userInput);

            //assert
            Assert.Equal(44, actual);
        }
Exemplo n.º 2
0
        public void Knth_Is_Length_From_End_Test()
        {
            //Arrange
            DataStructures.LinkedLists testList = new LinkedLists();
            testList.Insert(44);
            testList.Insert(13);
            testList.Insert(86);
            testList.Insert(75);
            int userInput = 3;

            //act
            int actual = testList.KnthFromEnd(userInput);

            //assert
            Assert.Equal(75, actual);
        }
Exemplo n.º 3
0
        public void Knth_Is_Where_K_Is_Negative_Test()
        {
            //Arrange
            DataStructures.LinkedLists testList = new LinkedLists();
            testList.Insert(44);
            testList.Insert(13);
            testList.Insert(86);
            testList.Insert(75);
            int userInput = -3;


            //Assert
            Assert.Throws <IndexOutOfRangeException>(() =>
            {
                //act
                int actual = testList.KnthFromEnd(userInput);
            });
        }