예제 #1
0
        public void RemoveAt_should_return_true_if_item_has_been_deleted()
        {
            //Arrange
            var list = new Structures.LinkedList <int>();

            list.AddLast(1);
            int index = 0;

            //Act
            bool result = list.RemoveAt(index);

            //Assert
            Assert.True(result);
        }
예제 #2
0
        public void RemoveAt_should_return_false_if_index_if_out_of_range()
        {
            //Arrange
            var list = new Structures.LinkedList <int>();

            list.AddLast(1);
            int index = -1;

            //Act
            bool result = list.RemoveAt(index);

            //Assert
            Assert.False(result);
        }
예제 #3
0
        public void RemoveAt_should_decrease_count_if_success()
        {
            //Arrange
            Structures.LinkedList <int> list = GetIntegerList();
            int index = 0;

            list.AddLast(1);
            var expectedLength = list.Length - 1;

            //Act
            list.RemoveAt(index);
            var length = list.Length;

            //Assert
            Assert.AreEqual(expectedLength, length);
        }