public void CheckIfAddBeforeWorksCorrectly() { var linkedList = new DataStructures.DoubleLinkedListCollection <int>(); linkedList.Add(1); linkedList.Add(3); linkedList.AddBefore(linkedList.Find(3), 2); Assert.Equal(2, linkedList.Find(1).NextLink.Value); }
public void CheckIfAddBeforeArgumentNullExceptionWorksCorrectly() { var linkedList = new DataStructures.DoubleLinkedListCollection <int>(); linkedList.Add(1); linkedList.Add(2); linkedList.Add(3); Assert.Throws <ArgumentNullException>(() => linkedList.AddBefore(null, 2)); }
public void CheckIfAddBeforeExceptionReadOnlyWorksCorrectly() { var linkedList = new DataStructures.DoubleLinkedListCollection <int>(); linkedList.Add(1); linkedList.Add(2); linkedList.Add(3); linkedList.MakeReadOnly(); Assert.Throws <NotSupportedException>(() => linkedList.AddBefore(linkedList.Find(3), 2)); }
public void CheckIfAddBeforeInvalidOperationExceptionWorksCorrectly() { var linkedList = new DataStructures.DoubleLinkedListCollection <int>(); linkedList.Add(1); linkedList.Add(2); linkedList.Add(3); var newLink = new DataStructures.DoubleLink <int>(5); Assert.Throws <InvalidOperationException>(() => linkedList.AddBefore(newLink, 2)); }