System.Collections.Tests.SortedListTests.GetKeyList_TryingToModifyCollection_ThrowsNotSupportedException C# (CSharp) Méthode

GetKeyList_TryingToModifyCollection_ThrowsNotSupportedException() private méthode

        public static void GetKeyList_TryingToModifyCollection_ThrowsNotSupportedException()
        {
            SortedList sortList1 = Helpers.CreateIntSortedList(100);
            Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 =>
            {
                IList keys = sortList2.GetKeyList();

                Assert.Throws<NotSupportedException>(() => keys.Add(101));
                Assert.Throws<NotSupportedException>(() => keys.Clear());
                Assert.Throws<NotSupportedException>(() => keys.Insert(0, 101));
                Assert.Throws<NotSupportedException>(() => keys.Remove(1));
                Assert.Throws<NotSupportedException>(() => keys.RemoveAt(0));
                Assert.Throws<NotSupportedException>(() => keys[0] = 101);
            });
        }
SortedListTests