Exemplo 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);
 }
Exemplo n.º 2
0
 public void RemoveLastItemShouldSucceed()
 {
     DsalLinkedList linkedList = new DsalLinkedList();
     linkedList
         .AddItems(new int[] { 5, 7, 10 })
         .RemoveItem(10)
         .ToList()
         .Should().BeEquivalentTo(5, 7);
 }
Exemplo n.º 3
0
 public void RemoveItemFromMiddleShouldSucceed()
 {
     DsalLinkedList linkedList = new DsalLinkedList();
     linkedList
         .AddItems(new int[] { 5, 7, 10 })
         .RemoveItem(7)
         .ToList()
         .Should().BeEquivalentTo(5, 10);
 }
Exemplo 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);
        }
Exemplo 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);
        }