public void Test_ExceptionIndexOfListIsReadOnly() { var intList = new ListCollection <int> { 1, 2, 3, 4, 5 }; var readOnly = new ReadOnlyListCollection <int>(intList); Assert.Equal(2, readOnly.IndexOf(3)); }
public void Test_ExceptionContainsListIsReadOnly() { var intList = new ListCollection <int> { 1, 2, 3, 4, 5 }; var readOnly = new ReadOnlyListCollection <int>(intList); Assert.Contains(1, readOnly); }
public void Test_ExceptionCountListIsReadOnly() { var intList = new ListCollection <int> { 1, 2, 3, 4, 5 }; var readOnly = new ReadOnlyListCollection <int>(intList); Assert.Equal(5, readOnly.Count); }
public void Test_ExceptionClearListIsReadOnly() { var intList = new ListCollection <int> { 1, 2, 3, 4, 5 }; var readOnly = new ReadOnlyListCollection <int>(intList); var checkGet = Assert.Throws <NotSupportedException>(() => readOnly.Clear()); Assert.Equal("List is readonly!", checkGet.Message); }
public void Test_CopyListToArrayReadOnly() { var intList = new ListCollection <int> { 1, 2, 3 }; var readOnly = new ReadOnlyListCollection <int>(intList); int[] array = { 1, 2 }; var checkGet = Assert.Throws <NotSupportedException>(() => readOnly.CopyTo(array, 3)); Assert.Equal("List is readonly!", checkGet.Message); }
public void Test_ExceptionEnumeratorListIsReadOnly() { var intList = new ListCollection <int> { 1, 2, 3, 4, 5 }; var readOnly = new ReadOnlyListCollection <int>(intList); var checkGet = Assert.Throws <NotSupportedException>(() => readOnly.RemoveAt(2)); var enumerator = readOnly.GetEnumerator(); enumerator.MoveNext(); enumerator.MoveNext(); enumerator.MoveNext(); enumerator.MoveNext(); enumerator.MoveNext(); Assert.Equal(5, enumerator.Current); }
/// <summary> /// /// </summary> /// <param name="collection"></param> public WebRequestExceptionCollection(IEnumerable <WebRequestException> collection) : base(collection) { _innerRepository = new ReadOnlyListCollection <IExternalResult>(collection); }