1
Vote

AddAfter of DoublyLinkedList throws NullReferenceException

description

public void AddAfter101281577093()
    {
        DoublyLinkedList<int> doublyLinkedList;
        doublyLinkedList = new DoublyLinkedList<int>();
        doublyLinkedList.AddLast(0);
        DoublyLinkedListNode<int> s0 = new DoublyLinkedListNode<int>(0);
        s0.Next = (DoublyLinkedListNode<int>)null;
        s0.Previous = (DoublyLinkedListNode<int>)null;
        doublyLinkedList.AddAfter(s0, 0);
        Assert.IsNotNull((object)doublyLinkedList);
        Assert.IsNotNull(doublyLinkedList.Head);
        Assert.AreEqual<int>(0, doublyLinkedList.Head.Value);
        Assert.IsNotNull(doublyLinkedList.Head.Next);
        Assert.AreEqual<int>(0, doublyLinkedList.Head.Next.Value);
        Assert.IsNull(doublyLinkedList.Head.Next.Next);
        Assert.IsNotNull(doublyLinkedList.Head.Next.Previous);
        Assert.IsTrue(object.ReferenceEquals
                          (doublyLinkedList.Head.Next.Previous, doublyLinkedList.Head));
        Assert.IsNull(doublyLinkedList.Head.Previous);
        Assert.IsNotNull(doublyLinkedList.Tail);
        Assert.IsTrue
            (object.ReferenceEquals(doublyLinkedList.Tail, doublyLinkedList.Head.Next));
        Assert.AreEqual<bool>
            (false, ((CollectionBase<int>)doublyLinkedList).IsSynchronized);
        Assert.AreEqual<int>(2, ((CollectionBase<int>)doublyLinkedList).Count);
    }

comments