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

            list.AddLast(1);

            //Act
            var result = list.Remove(1);

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

            list.AddLast(1);

            //Act
            var result = list.Remove(2);

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

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

            //Act
            list.Remove(1);
            var length = list.Length;

            //Assert
            Assert.AreEqual(expectedLength, length);
        }
예제 #4
0
        public void Remove_should_remove_first_occurence_of_item()
        {
            //Arrange
            var list = new Structures.LinkedList <int>();

            list.AddLast(1);
            list.AddLast(2);
            list.AddLast(1);
            string expectedResult = "21";

            //Act
            list.Remove(1);

            //Assert
            Assert.AreEqual(expectedResult, GetStringOfElements(list));
        }