Exemplo n.º 1
0
        public void AllKeyValuePairsCanBeEnumerated()
        {
            var allItems = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("a", "a"),
                new KeyValuePair <string, string>("aa", "aa"),
                new KeyValuePair <string, string>("c", "c"),
                new KeyValuePair <string, string>("b", "b"),
            };

            var dictionary = new SearchDictionary <string>();

            foreach (var item in allItems)
            {
                dictionary.Add(item);
            }

            CollectionAssert.AreEqual(allItems.OrderBy(item => item.Key).ToArray(), dictionary.OrderBy(item => item.Key).ToArray());
        }