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

ContainsKey() private méthode

private ContainsKey ( ) : void
Résultat void
        public static void ContainsKey()
        {
            var sortList1 = new SortedList();
            Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 =>
            {
                for (int i = 0; i < 100; i++)
                {
                    string key = "Key_" + i;
                    sortList2.Add(key, i);
                    Assert.True(sortList2.Contains(key));
                    Assert.True(sortList2.ContainsKey(key));
                }

                Assert.False(sortList2.ContainsKey("Non_Existent_Key"));

                for (int i = 0; i < sortList2.Count; i++)
                {
                    string removedKey = "Key_" + i;
                    sortList2.Remove(removedKey);
                    Assert.False(sortList2.Contains(removedKey));
                    Assert.False(sortList2.ContainsKey(removedKey));
                }
            });
        }
SortedListTests