public void CheckIfAddFirstWorksCorrectly() { var linkedList = new DataStructures.DoubleLinkedListCollection <int>(); linkedList.Add(2); linkedList.Add(3); linkedList.AddFirst(1); Assert.Equal(1, linkedList.Find(2).PreviousLink.Value); }
public void CheckIfContainsWorksCorrectly2() { var linkedList = new DataStructures.DoubleLinkedListCollection <int>(); linkedList.Add(3); linkedList.Add(2); linkedList.Add(1); Assert.False(linkedList.Contains(4)); }
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 CheckIfAddAfterWorksCorrectly() { var linkedList = new DataStructures.DoubleLinkedListCollection <int>(); linkedList.Add(1); linkedList.Add(3); linkedList.AddAfter(linkedList.Find(1), 2); Assert.Equal(2, linkedList.Find(1).NextLink.Value); }
public void CheckIfRemoveLastReadonlyExceptionWorksCorrectly() { var linkedList = new DataStructures.DoubleLinkedListCollection <int>(); linkedList.Add(1); linkedList.Add(2); linkedList.Add(3); linkedList.MakeReadOnly(); Assert.Throws <NotSupportedException>(() => linkedList.RemoveLast()); }
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 CheckIfRemoveLastWorksCorrectly() { var linkedList = new DataStructures.DoubleLinkedListCollection <int>(); linkedList.Add(1); linkedList.Add(2); linkedList.Add(3); linkedList.RemoveLast(); Assert.Equal(null, linkedList.Find(3)); }
public void CheckIfRemoveWorksCorrectly() { var linkedList = new DataStructures.DoubleLinkedListCollection <int>(); linkedList.Add(1); linkedList.Add(2); linkedList.Add(3); linkedList.Remove(2); Assert.Equal(3, linkedList.Find(1).NextLink.Value); }
public void CheckIfCopyToNotEnoughSpaceExceptionWorksCorrectly() { var linkedList = new DataStructures.DoubleLinkedListCollection <int>(); linkedList.Add(1); linkedList.Add(2); linkedList.Add(3); var array = new int[3]; Assert.Throws <ArgumentException>(() => linkedList.CopyTo(array, 1)); }
public void CheckIfCopyToIndexSmallerThanZeroExceptionWorksCorrectly() { var linkedList = new DataStructures.DoubleLinkedListCollection <int>(); linkedList.Add(1); linkedList.Add(2); linkedList.Add(3); var array = new int[20]; Assert.Throws <ArgumentOutOfRangeException>(() => linkedList.CopyTo(array, -10)); }
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)); }
public void CheckIfEqualsWorksCorrectly1() { var linkedList = new DataStructures.DoubleLinkedListCollection <int>(); linkedList.Add(1); linkedList.Add(2); linkedList.Add(3); var equalObject = linkedList; Assert.True(linkedList.Equals(equalObject)); }
public void CheckIfFindLastWorksCorrectly() { var linkedList = new DataStructures.DoubleLinkedListCollection <int>(); linkedList.Add(1); linkedList.Add(2); linkedList.Add(3); const int i = 2; linkedList.Add(i); Assert.Equal(linkedList.Find(2).NextLink.NextLink, linkedList.FindLast(2)); }