Ejemplo n.º 1
0
 public void Remove2ndFromLastShouldSucceed()
 {
     DsalLinkedList linkedList = new DsalLinkedList();
     linkedList
         .AddItems(new int[] { 5, 7, 10, 12 })
         .RemoveNthFromLast(2)
         .ToList()
         .Should().BeEquivalentTo(5, 7, 12);
 }
Ejemplo n.º 2
0
 public void RemoveLastItemShouldSucceed()
 {
     DsalLinkedList linkedList = new DsalLinkedList();
     linkedList
         .AddItems(new int[] { 5, 7, 10 })
         .RemoveItem(10)
         .ToList()
         .Should().BeEquivalentTo(5, 7);
 }
Ejemplo n.º 3
0
 public void RemoveItemFromMiddleShouldSucceed()
 {
     DsalLinkedList linkedList = new DsalLinkedList();
     linkedList
         .AddItems(new int[] { 5, 7, 10 })
         .RemoveItem(7)
         .ToList()
         .Should().BeEquivalentTo(5, 10);
 }
Ejemplo n.º 4
0
        public void Remove4thNodeFromLastIn4LengthLinkedListShouldSucceed()
        {
            DsalLinkedList linkedList = new DsalLinkedList();

            linkedList
                .AddItems(new int[] { 5, 7, 10, 12 })
                .RemoveNthFromLast(4)
                .ToList()
                .Should().BeEquivalentTo(7, 10, 12);
        }
Ejemplo n.º 5
0
        public void DeletingDuplicatesShouldGetRidOffAlltheDuplicates()
        {
            DsalLinkedList linkedList = new DsalLinkedList();

            linkedList
                .AddItems(new int[] { 1, 2, 1, 3, 3, 5 })
                .DeleteDuplicates()
                .ToList()
                .Should().BeEquivalentTo(1, 2, 3, 5);
        }