public void TestInsertElementWhenSortedListIsEmpty() { var array = new SortedListCollection <int>(); array.Insert(0, 100); var checkGet = Assert.Throws <ArgumentException>(() => array.Insert(2, 111)); Assert.Equal("Invalid Index; must be greater then 0 and less than \r\nParameter name: Count = 1", checkGet.Message); Assert.Equal(0, array.IndexOf(100)); Assert.Equal(1, array.Count); }
public void TestInsertElementWhenResultingIntListIsNotSorted() { var array = new SortedListCollection <int> { 1, 4, 6, 8 }; array.Insert(2, 100); Assert.Equal(-1, array.IndexOf(100)); Assert.Equal(4, array.Count); }
public void TestInsertElementWhenResultingIntListIsSorted() { var array = new SortedListCollection <int> { 1, 4, 6, 8 }; array.Insert(2, 5); Assert.Equal(2, array.IndexOf(5)); Assert.Equal(5, array.Count); }